Forum Discussion
RenanPNog
Helper I
3 years agoDax Week Calculation - Power BI
Hey folks! I'm having some trouble trying to calculate weeknumbers.... That's because, i have a sells time period, and i want to check how many weeks are left of that period. I've tried DATEDIFF f...
- 3 years ago
CBT_Dez
2 years agoNew Member
Hi Payeras_BI,
I'm struggling with DAX Datediff week caculation,
power bi dax No. of weeks = datediff(date(2023,11,15), date(2023,11,28), week) correctly returned result as 2, why did my power bi desktop for this formula No. of weeks = datediff(date(2023,09,06), date(2023,11,28), week) returned result of 12 when it should be 11?
I used co-pilot trying to find solution, one of the suggestions was to use datevalue; and I changed the formula to
No. of weeks = datediff(DATEVALUE("2023-09-06"), datevalue("2023-11-28"), week)
The returned result was still 12 instead of 11.
Can you suggest what went wrong with the formula please?
In order to get the correct result on my reports for now, I have changed it to
No. of weeks = INT(datediff(date(2023,09,06), date(2023,11,28), week))
CBT_Dez
2 years agoNew Member
Correction:
In order to get the correct result on my reports for now, I have changed it to
No. of weeks = INT(datediff(date(2023,09,06), date(2023,11,28), day) / 7)