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
Anonymous
Not applicable

if else condition in 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-1675661479394.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 IND= if(max('GSD Stats'[USA/UK/IND])="IND",1,0)
var USA= if(max('GSD Stats'[USA/UK/IND])="USA",1,0)
var UK= if(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
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below 

Picker filter = 
VAR _selcountry =
    ALLSELECTED ( 'Country'[Country] )
VAR _seluui =
    SELECTEDVALUE ( 'GSD Stats'[USA/UK/IND] )
RETURN
    IF ( _seluui IN _selcountry, 1, 0 )

2. Create a table visual and apply a visual-level filter on the visaul with the condition(Picker filter is 1)

yingyinr_0-1675750844181.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below 

Picker filter = 
VAR _selcountry =
    ALLSELECTED ( 'Country'[Country] )
VAR _seluui =
    SELECTEDVALUE ( 'GSD Stats'[USA/UK/IND] )
RETURN
    IF ( _seluui IN _selcountry, 1, 0 )

2. Create a table visual and apply a visual-level filter on the visaul with the condition(Picker filter is 1)

yingyinr_0-1675750844181.png

Best Regards

FreemanZ
Super User
Super User

hi @Anonymous 

are you expecting the field parameter?

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters

 

Anonymous
Not applicable

Hi @FreemanZ ,

 

Not sure. How can I use this with parameters.

Could you please help

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.