Forum Discussion

Stella_V's avatar
Stella_V
Frequent Visitor
2 years ago
Solved

Calculate a hourly difference per dimensions

Hello 

I am trying to calculate a hourly difference, for the selected day in a date slicer, between two attributes.

More precisely I want to calculate th difference in "Value" between France and Austria, per hour on the same day, for the attribute  'forecast1'.

 

 TimeHourAttribute1Attribute2Value
D24.10.20231.00AustriaForecast110
D24.10.20232.00AustriaForecast120
D24.10.20233.00AustriaForecast130
D24.10.20234.00AustriaForecast140
D24.10.20235.00AustriaForecast150
D24.10.20231.00FranceForecast125
D24.10.20232.00FranceForecast1140
D24.10.20233.00FranceForecast160
D24.10.20234.00FranceForecast150
D24.10.20235.00FranceForecast165
      
 ResulthourAttribute3Attribute2Value
 24.10.20231.00France-AutriaForecast115
 24.10.20232.00France-AutriaForecast1120
 24.10.20233.00France-AutriaForecast130
 24.10.20234.00France-AutriaForecast110
 24.10.20235.00France-AutriaForecast115

 

Can you please help me? I did a direct query. 

thank you very much !

Stella

 

  • Stella_V,

     

    This approach will work with multiple Forecasts (Forecast1, Forecast2, etc.) - I dare you to try. 🙂 Should you face any issues, let me know.

     

    >>Should we add an additional filter on the Attribute2?

    There is no need to apply additional filtering.

     

    Cheers,

    Alexander

4 Replies

  • Hi Stella_V,

    If you want to solve your task via a Table visual, you could create such a measure and use it:

    In plain text:

    NewValue = SUMX ( FILTER ( Data, [Attribute1] = "France" ), [Value] ) - SUMX ( FILTER ( Data, [Attribute1] = "Austria" ), [Value] )

    Best Regards,

    Alexander

    My YouTube vlog in English

    My YouTube vlog in Russian

     

    • Stella_V's avatar
      Stella_V
      Frequent Visitor

      Hello 

       

      thank you very much for your answer. 

       

      I forgot to mention you that there are several different attributes in the column "Attribute 2" for example: 

       

      Hour 1 Forecast1

      Hour 2 Forecast1

      Hour 3 Forecast1

      Hour 4 Forecast1

       

      Hour 1 Forecast2

      Hour 2 Forecast2

      Hour 3 Forecast2

      Hour 4 Forecast2

       

      Hour 1 Forecast3

      Hour 2 Forecast3

      Hour 3 Forecast3

      Hour 4 Forecast3

       

      Should we add an additional filter on the Attribute2? What  I need is the hourly difference between two countries, per forecast type.

       

      thank you !!
      Stella

       

       

      • barritown's avatar
        barritown
        Icon for Solution Sage rankSolution Sage

        Stella_V,

         

        This approach will work with multiple Forecasts (Forecast1, Forecast2, etc.) - I dare you to try. 🙂 Should you face any issues, let me know.

         

        >>Should we add an additional filter on the Attribute2?

        There is no need to apply additional filtering.

         

        Cheers,

        Alexander