Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi all,
I'm trying to make a measure based on multiple selectedvalues. The idea is a comparison page, where the measure can show a comparison of a price based on different filters. The idea is to make a whole filter pane and for each filter use a selectedvalue. Problem is I'm getting stuck when I'm trying to use more as 1 selectedvalue statement. The measure only shows a value if the first statement is not blank, but I want it to show no filter when nothing is selected (so kind of select all). Any idea?
Below is what I got now. It has 2 main problems
- It isn't scalable. If there will be 8 slicers the code will be huge. Other slicers that will be added are f.e.: date, supplier_location, country
- When selectedsupplier is empty and selecteddaytime is empty it only takes the values WITHOUT a daytime value. It should be variable: taking all the values with no selection and only taking the selected values with a selection. This is the case for all the slicers. I've tried to solve it with an if statement now but is there a workaround?
VAR selectedsupplier = SELECTEDVALUE('for slicer'[supplier])
VAR selecteddaytime = SELECTEDVALUE('for slicer2'[daytime])
RETURN
IF(isblank(selectedsupplier),
CALCULATE(
AVERAGE('unit_price_DIM'[price])
,FILTER(ALL('unit_price_DIM'), 'unit_price_DIM'[daytime] = selecteddaytime)
,GROUPBY('unit_price_DIM','unit_price_DIM'[product_group_name])
),
CALCULATE(
AVERAGE('unit_price_DIM'[price])
,FILTER(ALL('unit_price_DIM'), 'unit_price_DIM'[supplier] = selectedsupplier)
,FILTER(ALL('unit_price_DIM'), 'unit_price_DIM'[daytime] = selecteddaytime)
,GROUPBY('unit_price_DIM','unit_price_DIM'[product_group_name])
)
)
Thanks in advance!
Hi, @Anonymous
Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
96 | |
87 | |
78 | |
72 | |
69 |
User | Count |
---|---|
113 | |
105 | |
84 | |
65 | |
64 |