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.
This has been asked to death, but none of the previous solutions seems to work for me, please help.
My metric is grouped by Week End label in the calendar table (WE2019-07-05, for example).
In my calendar table I have the label and the label keys for the week end, like so:
I'm trying to use the following formula which does not work. What am I doing wrong?
Visits PW =
CALCULATE(
[Total Visits],
FILTER(
ALL('Calendar'),
'Calendar'[Week Ending Date Key] = 'Calendar'[Week Ending Date Key] - 1
)
)
Solved! Go to Solution.
You need to modify the measure to:
Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
[Total Visits],
FILTER(
ALL('Calendar'),
'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 7
)
)
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
You need to modify the measure to:
Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
[Total Visits],
FILTER(
ALL('Calendar'),
'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 7
)
)
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
@MightyMicrobe , because of for every row in a table there are checking condition:
'Calendar'[Week Ending Date Key] = 'Calendar'[Week Ending Date Key] - 1
For example, 'Calendar'[Week Ending Date Key] = 20190712, then condition will be
20190712 = 20190712 - 1
So it's always FALSE for every row in table.
Solution:
Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
[Total Visits],
FILTER(
ALL('Calendar'),
'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 1
)
)
Thanks for this. I tried the solution, and while there are no errors, the formula returns blanks in the matrix.
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |