Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello everyone.
I would like to calculate sales for all years prior to the selected year in a filter with the year field from the calendar table.(including the year itself).
If I write the measure in this way it works (for example for all sales prior 2023)
Rolling All 1 =
CALCULATE (
SUM(Sales[Amount[) ,
FILTER (
Sales,
Sales[Year] <= 2022))
But if i Try to dynamically pass year selected from the user by the filter, it does not work and show me only 2022 sales
Rolling All 2=
var YearSelected= SELECTEDVALUE(Calendar[Year] )
RETURN
CALCULATE (
SUM(Sales[Amount[) ,
FILTER (
Sales,
Sales[Year] <= YearSelected))
What is the way to pass a value selected by a filter to a measure? (in this case filter linked to the calendar and specifically to the year)
Thank you very much
Solved! Go to Solution.
Sorry, I solved with this code:
Sorry, I solved with this code:
Try
Rolling All 2 =
VAR YearSelected =
SELECTEDVALUE ( Calendar[Year] )
RETURN
CALCULATE (
SUM ( Sales[Amount] ),
'Calendar'[Year] <= YearSelected,
REMOVEFILTERS ( 'Calendar' )
)
User | Count |
---|---|
52 | |
51 | |
20 | |
17 | |
16 |
User | Count |
---|---|
113 | |
46 | |
44 | |
28 | |
22 |