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,
I'm analyzing the gorgeous Corona Power BI Report provided by zammikahan (original Link)
Right now I'm stuck at some point. I want to analyze new confirmed cases. If there's no date filter added, everything works fine.
The issue appears, when I'm filtering on a specific date. (See screenshot 2)
I can't resolve where the value of 411 is coming from. It should be yesterday's value (23.892).
As a result "confirmed cases" should still be 3.743 (27.635 - 23.892) in the second screenshot.
New confirmed cases yesterday temp = CALCULATE(SUM('Corona Summary'[Confirmed Cases]), PREVIOUSDAY('Corona Summary'[Date]))
It seems like the previousday filter isn't applied if I'm filtering on a specific date. Is there a way to bypass this behaviour ?
Maybe someone has an idea.
Thanks a lot
Solved! Go to Solution.
@mantaga
Previousday() returns a table of dates, when you filter the date, the context will change dynamically. Try add ALL(Corona Summary) as another filter behind.
New confirmed cases yesterday temp =
CALCULATE(SUM('Corona Summary'[Confirmed Cases]), PREVIOUSDAY('Corona Summary'[Date]),ALL('Corona Summary'))
You may also need ALL(Corona Summary) for other measures, for example:
New Confirmed Cases =
VAR vToday = MAX('Corona Summary'[Date])
VAR vYesterday = MAX('Corona Summary'[Date]) -1
RETURN CALCULATE(SUM('Corona Summary'[Confirmed Cases]), 'Corona Summary'[Date] = vToday,ALL('Corona Summary')) - CALCULATE(SUM('Corona Summary'[Confirmed Cases]), 'Corona Summary'[Date] = vYesterday,ALL('Corona Summary'))
Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@mantaga
Previousday() returns a table of dates, when you filter the date, the context will change dynamically. Try add ALL(Corona Summary) as another filter behind.
New confirmed cases yesterday temp =
CALCULATE(SUM('Corona Summary'[Confirmed Cases]), PREVIOUSDAY('Corona Summary'[Date]),ALL('Corona Summary'))
You may also need ALL(Corona Summary) for other measures, for example:
New Confirmed Cases =
VAR vToday = MAX('Corona Summary'[Date])
VAR vYesterday = MAX('Corona Summary'[Date]) -1
RETURN CALCULATE(SUM('Corona Summary'[Confirmed Cases]), 'Corona Summary'[Date] = vToday,ALL('Corona Summary')) - CALCULATE(SUM('Corona Summary'[Confirmed Cases]), 'Corona Summary'[Date] = vYesterday,ALL('Corona Summary'))
Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your support.
Your solution works perfectly fine 🙂
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
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 |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |