Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I've created 3 What If parameters Date - Year, Date - Month, and Date - Day.
I have a two measures already to calculate the total cases pre and post a date, these are;
Total Cases (Post 16/03) =
CALCULATE (
[Total Cases (Distinct)],
ALL ( 'Calendar' ),
FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( 2020, 03, 16 ) )
)
Total Cases (Pre 16/03) =
CALCULATE (
[Total Cases (Distinct)],
ALL ( 'Calendar' ),
FILTER (
'Calendar',
AND (
'Calendar'[Date] >= DATE ( 2020, 01, 01 ),
'Calendar'[Date] < DATE ( 2020, 03, 16 )
)
)
)
What I wanted to do was replace the hardcoded date with the values from the What If parameters so the users can move this date, so if we take Total Cases (Pre 16/03) I've done this;
Total Cases (Pre 16/03) =
CALCULATE (
[Total Cases(Distinct)],
ALL ( 'Calendar' ),
FILTER (
'Calendar',
AND (
'Calendar'[Date] >= DATE ( 2020, 01, 01 ),
'Calendar'[Date] < DATE ( [Date - Year Value], [Date - Month Value], [Date - Day Value] )
)
)
)
This returns nothing and when troubleshooting its the parameters causing the issue as it returns a blank calendar table.
Is what I want to do possible?
Solved! Go to Solution.
Try:
Total Cases (Pre 16/03) =
VAR __Year = SELECTEDVALUE([Date - Year Value])
VAR __Month = SELECTEDVALUE([Date - Month Value])
VAR __Day = SELECTEDVALUE([Date - Day Value])
CALCULATE (
[Total Cases(Distinct)],
ALL ( 'Calendar' ),
FILTER (
'Calendar',
AND (
'Calendar'[Date] >= DATE ( 2020, 01, 01 ),
'Calendar'[Date] < DATE ( __Year, __Month, __Day )
)
)
)
Tried the same thing earlier and it didn't work, but tried yours anyway and then realised it was because I didn't have the Sync Slicers option set correctly!
Thanks for the help.
Try:
Total Cases (Pre 16/03) =
VAR __Year = SELECTEDVALUE([Date - Year Value])
VAR __Month = SELECTEDVALUE([Date - Month Value])
VAR __Day = SELECTEDVALUE([Date - Day Value])
CALCULATE (
[Total Cases(Distinct)],
ALL ( 'Calendar' ),
FILTER (
'Calendar',
AND (
'Calendar'[Date] >= DATE ( 2020, 01, 01 ),
'Calendar'[Date] < DATE ( __Year, __Month, __Day )
)
)
)
User | Count |
---|---|
15 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |