Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
108 | |
108 | |
108 | |
90 | |
61 |
User | Count |
---|---|
171 | |
138 | |
132 | |
102 | |
86 |