6 Replies Latest reply on Sep 29, 2018 5:27 PM by Okechukwu Ossai

# comparing current temperature to predicted temperature

Dear Tableau Masters,

I would like to create a chart, that shows for any given hour the current temperature, as well as the temperature forecast that was predicted an hour earlier.

Example: on [scrape time local] Sep. 24 at 10pm the current [temperature] in [location] Lagos de Obidos was 19,12°C. An hour earlier on [local time minus 1 hour] Spe 24. at 9pm the 1 hour temperature forecasted for 10 pm [Forecast1 Temperature] was 19,76°C.

I have created two calculated fields:

--> local time minus 1 hour

ATEADD('hour', -1, [Scrape Time Local])

--> 1 hour prediction

{ FIXED [local time minus 1hour]:AVG([Forecast1 Temperature]) }

What I would like to see in one chart on Sep 24 at 10pm, is the current temperature at 10pm (19,12°C) and the forecasted temperature, that was predicted at 9pm for 10pm (19,76°C). Does anyone have an idea how to do this? I have attached my workbook. Thanks a lot.

• ###### 1. Re: comparing current temperature to predicted temperature

Hi Sandra,

Is this what you are looking for? I used a table calc function to lookup temperatures predicted 1 hour earlier. See attached workbook.

Hope this helps.

Ossai

• ###### 2. Re: comparing current temperature to predicted temperature

Dear Ossai,

thank you so much. This is a great start to have both values available. Is there a way to show them as separate points / lines though to make the difference visible. In the end I would like to have a line chart that shows the current vs the 1-12 hour forecasts over time. So 13 lines.

Kind regards,
Sandra

• ###### 3. Re: comparing current temperature to predicted temperature

Dear Ossai,

thanks so much. Putting the two lines in one diagram was easy Wonderful.

Have a nice day, Sandra

• ###### 4. Re: comparing current temperature to predicted temperature

You are welcome Sandra. Good you figured it out.

• ###### 5. Re: comparing current temperature to predicted temperature

I have two question regarding this table calculation

LOOKUP(MIN([Forecast1 Temperature]), -1)

I would like to aggregate these measures across locations to show the average current temperature vs the average 1-12 hour forecast? As I understand the calculation, lookup returns the value of a target row, but can I perform calculations "on Top", such as aggregation.

What is the reason for using MIN?

Thanks a lot and kind regards,
Sandra

• ###### 6. Re: comparing current temperature to predicted temperature

All fields must be aggregates when using table calculations. Hence, I used MIN() to aggregate Forecast1 Temperature. You can also use ATTR(), MAX(), SUM() or AVG() depending on the data type. It is a row level calculation, so wouldn't matter the one you choose as long as the data type is compatible.

All table calculations are already pre-aggregated and cannot be further aggregated. It depends on what you want to do. You can aggregate the forecasts before applying the lookup function.