Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Am calculating year on year based on last 4 weeks. My issue is for some reason my calculation seems to stop working as soon as i filter, i am working with Start of Week dates which makes it a little bit of a pain;
Solved! Go to Solution.
Hi @Anonymous ,
The problem is the DATESINPERIOD(). The table Revenue inputed to DATESINPERIOD to be calculated has been filtered by field in the visual. So the result of DATESINPERIOD is not all Revenue table.
For example , the result of MAX(Revenue[Start of Week Date]) is 2021/11/19, then the result of DATESINPERIOD will be 2021/11/1 to 2021/11/19 instead of 2021/10/24.
May be you can try FILTER() instead of DATESINPERIOD().
Last 4 weeks =
CALCULATE(
SUM( Revenue[Cost] ),
FILTER(
ALL( Revenue ),
Revenue[Start of Week Date]
>= MAX( Revenue[Start of Week Date] ) - 27
&& Revenue[Start of Week Date] <= MAX( Revenue[Start of Week Date] )
)
)
If I misunderstood you please let me know. And you can share some example data without sensitive data.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
The problem is the DATESINPERIOD(). The table Revenue inputed to DATESINPERIOD to be calculated has been filtered by field in the visual. So the result of DATESINPERIOD is not all Revenue table.
For example , the result of MAX(Revenue[Start of Week Date]) is 2021/11/19, then the result of DATESINPERIOD will be 2021/11/1 to 2021/11/19 instead of 2021/10/24.
May be you can try FILTER() instead of DATESINPERIOD().
Last 4 weeks =
CALCULATE(
SUM( Revenue[Cost] ),
FILTER(
ALL( Revenue ),
Revenue[Start of Week Date]
>= MAX( Revenue[Start of Week Date] ) - 27
&& Revenue[Start of Week Date] <= MAX( Revenue[Start of Week Date] )
)
)
If I misunderstood you please let me know. And you can share some example data without sensitive data.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.