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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.