Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Multiple SELECTEDVALUE statements within measure

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!

1 REPLY 1
v-zhangti
Community Support
Community Support

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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.