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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

if else statement in dax function

Hello All,

 

I have a tableau dashboard where I have parameter having values like US and Canada,APAC and Overall.

And I have department values like Central,Georgia,Hyd and Pune

 

My requirement is If I select region as US and Canada then I need to show only Central,Georgia

                               If I select region as APAC then I need to show only Hyd,Pune

                                If I select region as Overall then I need to show All 4.i.e, Central,Georgia,Hyd,Pune

 

Below is my logic in Tableau and I am not sure how to write in power BI as I am new.

Could some one help how to write

 

I created a table inside power BI for the parameter values and not sure how to write after that

 

CASE [Region]
when 'US and Canada' then
[Department] = 'Central' or
[Department]= 'Georgia'
when 'APAC' then
[Department] = 'Hyd' or
[Department]= 'Pune'

when 'Overall' then
[Department] = 'Central' or
[Department] = 'Georgia' or
[Department]= 'Hyd' or
[Department] = 'Pune'
END

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , Can you please share sample data and sample output in table format?

 

I provided a solution on this topic last time, seems like that did not work for you. So need sample

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

Yes @amitchandak ,

 

As per your solution whenever I select US and Canada or APAC its not showing the respected departments that we writeen in the logic.

As per your dax function I am getting only regions instead of the department names

 

Sample Data :

 

DepartmentSales
Central100
Georgia200
Hyd300
Pune400

 

Table I created in Power BI:

 

Region Names
US and Canada
APAC

 

Thats why I posted again

@Anonymous , You do not need a table you need a column. If you have that table join with this column

 

Switch( True() ,

[Department] in {"Central","Georgia"} , "US and Canada",

[Department] in {"Hyd","Pune"} , "APAC",

"Other"

)

 

If this does work, Please share the final outcome on tableau

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

Hi @amitchandak ,

 

Below is what I am expecting .

In the DAX you mentioned above you are not using the table I created inside power BI for regions.

 

Capture.JPG

Anonymous
Not applicable

Hi @amitchandak ,

 

Could you please help on this

@Anonymous , refer the new column code above

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
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.