Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
I have the following dataset and I want to calculate the difference between the 24.10.2023 Hour 1 and the 23.10.2023 Hour 1, and generally for each hour, between both days. I have already defined two measures as "Measure A, T" and "Measure A, T-1", being "T as today" and "T-1 as yesterday" . But I dont know how to calculate the difference between these two measures on a hourly basis.
Result should look like the image attached, equal to an hourly difference for every day.
Time | Hour | Measure A | |
D | 24.10.2023 | 1.00 | 0.009632 |
D | 24.10.2023 | 2.00 | 0.615008 |
D | 24.10.2023 | 3.00 | 0.712107 |
D | 24.10.2023 | 4.00 | 0.357265 |
D | 24.10.2023 | 5.00 | 0.922201 |
D-1 | 23.10.2023 | 1.00 | 0.468224 |
D-1 | 23.10.2023 | 2.00 | 0.447249 |
D-1 | 23.10.2023 | 3.00 | 0.096913 |
D-1 | 23.10.2023 | 4.00 | 0.714057 |
D-1 | 23.10.2023 | 5.00 | 0.61969 |
Difference | hour | Measure A | |
24.10.2023 - 23.10.2023 | 1.00 | -0.45859 | |
24.10.2023 - 23.10.2023 | 2.00 | 0.167759 | |
24.10.2023 - 23.10.2023 | 3.00 | 0.615194 | |
24.10.2023 - 23.10.2023 | 4.00 | -0.35679 | |
24.10.2023 - 23.10.2023 | 5.00 | 0.302511 |
thank you very much for your help
Kind regards
Solved! Go to Solution.
Hi, @Stella_V
You can try the following methods.
Previous Measure A = CALCULATE([Measure A],FILTER(ALL('Table'),[Time]=SELECTEDVALUE('Table'[Time])-1&&[Hour]=SELECTEDVALUE('Table'[Hour])))
Difference = IF([Previous Measure A]=BLANK(),BLANK(),[Measure A]-[Previous Measure A])
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello
sorry but it does not work actually the way i wanted. The "Mesure A" is not a measure but a value within the table. I called it wrong with measure. Also, I need to add one condition, as such:
- I need to calculate the hourly difference between D and D-1 between two countries as shown below:
i think we would do an additional filter on the country?
thanks a lot
Yes that's the result i expect. Works perfectly, thank you 🙂 !!!
Hi, @Stella_V
You can try the following methods.
Previous Measure A = CALCULATE([Measure A],FILTER(ALL('Table'),[Time]=SELECTEDVALUE('Table'[Time])-1&&[Hour]=SELECTEDVALUE('Table'[Hour])))
Difference = IF([Previous Measure A]=BLANK(),BLANK(),[Measure A]-[Previous Measure A])
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.