The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
81 | |
63 | |
56 |
User | Count |
---|---|
247 | |
122 | |
110 | |
77 | |
72 |