Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
Datediff is not calculating correctly, I want to calculate the difference in days between the max date and mindate of a particular date column (Production Date Time).
Can you please let me know what am i doing wrong here?
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario.
Fact:
You may create a measure like follows.
Date Diff =
DATEDIFF(
CALCULATE(MAX('Fact'[Production Date-Time]),ALLSELECTED('Fact')),
CALCULATE(MIN('Fact'[Production Date-Time]),ALLSELECTED('Fact')),
DAY
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario.
Fact:
You may create a measure like follows.
Date Diff =
DATEDIFF(
CALCULATE(MAX('Fact'[Production Date-Time]),ALLSELECTED('Fact')),
CALCULATE(MIN('Fact'[Production Date-Time]),ALLSELECTED('Fact')),
DAY
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks , this works. I was actually making those date diff calculations in calculated column, when i used measures its working.
I also tried
Date diff measure requires context. Refer :https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
85 | |
83 | |
66 | |
61 | |
58 |
User | Count |
---|---|
194 | |
111 | |
105 | |
79 | |
71 |