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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply

Sort Data based on slicer selection

I have created one table which contained two options Yes or No.

I need to sort the data based on selected option. data is like this.

rock_stage_user_0-1666939491949.png

 

I want to sort this data according to selection

if i am selected yes then it will show only (Excluded data from agencies and mastercard) is true if i am selected No in the slicer it will show all the records pls can someone help me with this.

 

Measure = Var selection = SELECTEDVALUE(slicer[option]) RETURN (SWITCH(TRUE(),selection = "Yes",FILTER(new_processor_info,new_processor_info[Excluding data from agencies and Mastercard Employees]= TRUE()),selection="No",0))
 
I have created like this measure but didn't work giving error 
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
Measure = Var selection = SELECTEDVALUE(slicer[option]) RETURN (SWITCH(TRUE(),selection = "Yes",CALCULATE(DISTINCTCOUNT(new_processor_info[issuer_id]),FILTER(new_processor_info,new_processor_info[Excluding data from agencies and Mastercard Employees]= TRUE())),selection="No",0))
this measure also gives the wrong result which contaains false values also. i have added that measure into filters and set is 0 but still not working as expected.
2 REPLIES 2
amitchandak
Super User
Super User

@rock_stage_user , measure has to return single value,

 

example

Measure = Var selection = SELECTEDVALUE(slicer[option])
RETURN (SWITCH(TRUE(),
selection = "Yes",countrows(FILTER(new_processor_info,new_processor_info[Excluding data from agencies and Mastercard Employees]= TRUE())),
selection="No",0))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It is also gives the wrong result, i am trying to exclude the domains from main result.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.