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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

How to filter data based on slicer using dax

Hello All,

 

I need help on below logic.

I have report where I am having data like below.

My requirement is in the report side I created a table having 3 values USA , UK and IND and then showing in slicer to select.

 

Now If I select slicer value as USA I need to show [USA/UK/IND] filed value as USA

If I select slicer value as UK I need to show [USA/UK/IND] filed value as UK

If I select slicer value as IND I need to show [USA/UK/IND] filed value as IND.

 

Sathvik123_0-1675668812422.png

 

 

 

I created a measure like this and kept in filters of visuals to select 1 .

But its not working

 

1st Approach : ( Create a measure)

 

Picker filter =
var selected_value = SELECTEDVALUE(Country[Country])
var INDif(max('GSD Stats'[USA/UK/IND])="IND",1,0)
var USAif(max('GSD Stats'[USA/UK/IND])="USA",1,0)
var UKif(max('GSD Stats'[USA/UK/IND])="UK",1,0)

return IF(
    selected_value = "USA",
    USA,
    IF(
       selected_value ="UK",
        UK,
    IF(
       selected_value ="IND",
        IND
)))

 

2nd approach: ( Create a column)

 

I created a column like this and kept in filters.

But its not working

 

Picker filter = SWITCH(
    TRUE(),
    [SelectedValue] = "IND", 'GSD Stats'[USA/UK/IND]="IND",
     [SelectedValue] = "USA", 'GSD Stats'[USA/UK/IND]="USA",
     [SelectedValue]  = "UK",'GSD Stats'[USA/UK/IND]="UK"
    )
 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
New Table:

Slicer = VALUES('Table'[USA/UK/IND])

Measure:

Measure = 
IF ( SELECTEDVALUE ( Slicer[USA/UK/IND] ) = BLANK (),
    1,
    IF ( SELECTEDVALUE ( Slicer[USA/UK/IND] ) = SELECTEDVALUE ( 'Table'[USA/UK/IND] ),
        1,
        0
    )
)

vzhangti_0-1675758328981.png

Is this the result you expect?

 

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.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
New Table:

Slicer = VALUES('Table'[USA/UK/IND])

Measure:

Measure = 
IF ( SELECTEDVALUE ( Slicer[USA/UK/IND] ) = BLANK (),
    1,
    IF ( SELECTEDVALUE ( Slicer[USA/UK/IND] ) = SELECTEDVALUE ( 'Table'[USA/UK/IND] ),
        1,
        0
    )
)

vzhangti_0-1675758328981.png

Is this the result you expect?

 

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.

amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Measure =
var _sum = SWITCH(selectedvalue('GSD Stats'[USA/UK/IND])
TRUE(),
[SelectedValue] = "IND", Sum('GSD Stats'[IND Tickets]),
[SelectedValue] = "USA", Sum('GSD Stats'[USA Tickets]),
[SelectedValue] = "UK", Sum('GSD Stats'[UK Tickets])
)
return
calculate( _sum, 'GSD Stats'[USA/UK/IND] in {"IND", "USA", "UK"})

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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