Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi guys,
I'm trying to sum a column for a specific relative date range. Basically, I want to eventually calculate an average over the the 6 weeks prior to last week. (I want a show "last 6 weeks average," but I can't use the current week because current week's data is posted at the end of the week and therefor unreliable).
When I try creating a measure like this, it says I can't use the TODAY() function nor a measure.
Solved! Go to Solution.
Hi @Domenick ,
Please try the following formula:
Total Six Week Labor Spend =
VAR CurrentWeekStart =
TODAY () - WEEKDAY ( TODAY (), 2 ) + 1
RETURN
CALCULATE (
SUM ( 'LD (My Projects)'[BillExt] ),
FILTER (
'LD (My Projects)',
'LD (My Projects)'[TransDate] >= CurrentWeekStart - 42
&& 'LD (My Projects)'[TransDate] < CurrentWeekStart
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Domenick ,
Please try the following formula:
Total Six Week Labor Spend =
VAR CurrentWeekStart =
TODAY () - WEEKDAY ( TODAY (), 2 ) + 1
RETURN
CALCULATE (
SUM ( 'LD (My Projects)'[BillExt] ),
FILTER (
'LD (My Projects)',
'LD (My Projects)'[TransDate] >= CurrentWeekStart - 42
&& 'LD (My Projects)'[TransDate] < CurrentWeekStart
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can't use TODAY because DATEADD needs a column of values, not a single value. Try
Total Six Week Labor Spend = CALCULATE(SUM('LD (My Projects)'[BillExt]),
'LD (My Projects)'[TransDate]>TODAY() - 49,
'LD (My Projects)'[TransDate]<TODAY() - 7
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |