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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Case statement In Power Bi Dax

Hello All,

 

I have a calculate field in Tableau and Need to convert in Power Bi DAX.

Could any one please help how to write below in power bi

 

Here Region is my field.

I kept this in slicer and showing select All Option also.

In below formula Overall means select all in slicer.

 

Formula :

 

case [Region]

when 'Overall' then if
[Department]='Hyd' or
[Department]='Del' or
[Department]='Unknown' then 'Level1'
elseif
[Department]='Service Desk' then 'International Service Desk'
elseif [Department]='Service Desk India' then 'ISD India'
END
when 'ES' then IF
[Department]='Hyd' or
[Department]='Del' or
[Department]='Unknown' then 'Level1'
END
when 'ESI' then IF
[Department]='Service Desk' then 'ISD'
elseif [Department]='Service Desk India' then 'ISD India'

END
end

1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

@Anonymous Try this:

Calculated Column = SWITCH(TRUE(),
TableName[Region]="Overall" && TableName[Department] in {"Hyd","Del","Unknown"},"Level1",
TableName[Region]="Overall" && TableName[Department] = "Service Desk", "International Service Desk",
TableName[Region]="Overall" && TableName[Department] = "Service Desk India", ISD India",
TableName[Region]="ES" && TableName[Department] in {"Hyd","Del","Unknown"},"Level1",
TableName[Region]="ESI" && TableName[Department] = "Service Desk", "ISD",
TableName[Region]="ESI" && TableName[Department] = "Service Desk India", "ISD India"
)

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

1 REPLY 1
Tahreem24
Super User
Super User

@Anonymous Try this:

Calculated Column = SWITCH(TRUE(),
TableName[Region]="Overall" && TableName[Department] in {"Hyd","Del","Unknown"},"Level1",
TableName[Region]="Overall" && TableName[Department] = "Service Desk", "International Service Desk",
TableName[Region]="Overall" && TableName[Department] = "Service Desk India", ISD India",
TableName[Region]="ES" && TableName[Department] in {"Hyd","Del","Unknown"},"Level1",
TableName[Region]="ESI" && TableName[Department] = "Service Desk", "ISD",
TableName[Region]="ESI" && TableName[Department] = "Service Desk India", "ISD India"
)

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors