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 all,
At the moment i have a what if parameter so the users can select a month in a slicer, that parameter will be used in another dax formula.
I generate 12 month numbers and select the value from the slicer with the following DAX
MonthParValue = SELECTEDVALUE(MonthParameter[MonthPar])
After that i use that value in the following dax to select on a month basis.
EstimateCurrentMonth = calculate(sum('Sales'[Estimate]);FILTER(ALL('Sales'[MonthNumber]);[MonthNumber] = 'MonthParameter'[MonthParValue]))
this is working fine, but only if i select one month. I see that the selectedvalue returns only one value.
How can i change this so i can select multiple values from the slicer?
Thanks!
Solved! Go to Solution.
Hey,
I guess if you replace your estimation measure
EstimateCurrentMonth = calculate(sum('Sales'[Estimate]);FILTER(ALL('Sales'[MonthNumber]);[MonthNumber] = 'MonthParameter'[MonthParValue]))
with this
EstimateCurrentMonth = var selectedMonths = Values('MonthParameter'[MonthParValue]) return calculate( sum('Sales'[Estimate]) ;FILTER( ALL('Sales'[MonthNumber]) ;[MonthNumber] IN selectedMonths ) )
You are good to go.
Please be aware that the variable selectedMonths contains a table and no loger a scalar value. You also have to make sure that the slicer with the Month numbers has to be enabled for multi selection
Regards,
Tom
Hi @TomMartens
Thanks, but i think i fixed it fairly easily.
I created a measure
IsFiltered = ISCROSSFILTERED(MonthParameter[MonthPar])
In the other DAX a simple IF check seems to work fine..
IF(MonthNamesNumbersAsVar[IsFiltered] = TRUE;
calculate(..................
Hey,
I guess if you replace your estimation measure
EstimateCurrentMonth = calculate(sum('Sales'[Estimate]);FILTER(ALL('Sales'[MonthNumber]);[MonthNumber] = 'MonthParameter'[MonthParValue]))
with this
EstimateCurrentMonth = var selectedMonths = Values('MonthParameter'[MonthParValue]) return calculate( sum('Sales'[Estimate]) ;FILTER( ALL('Sales'[MonthNumber]) ;[MonthNumber] IN selectedMonths ) )
You are good to go.
Please be aware that the variable selectedMonths contains a table and no loger a scalar value. You also have to make sure that the slicer with the Month numbers has to be enabled for multi selection
Regards,
Tom
One other question, i see that the slicer returns all values as default, how can i set it so the slicer returns "nothing" as default?
Hi @TomMartens
Thanks, but i think i fixed it fairly easily.
I created a measure
IsFiltered = ISCROSSFILTERED(MonthParameter[MonthPar])
In the other DAX a simple IF check seems to work fine..
IF(MonthNamesNumbersAsVar[IsFiltered] = TRUE;
calculate(..................
Perfect!
Try with following
EstimateCurrentMonth = CALCULATE ( SUM ( 'Sales'[Estimate] ), FILTER ( ALL ( 'Sales'[MonthNumber] ), [MonthNumber] IN VALUES ( 'MonthParameter'[MonthParValue] ) ) )
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 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |