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
Pooji
Regular Visitor

Switch Statement in Custom column

Hi,

I am having the below column as DAX measure. Can anyone help me in writing the same statement while creating Custom Column.

Count of Comapnies = SWITCH(
'Data - Unpivot'[Fund - Copy], "Omega IV", CALCULATE(COUNTROWS('Data - Unpivot'),FILTER('Data - Unpivot','Data - Unpivot'[Fund - Copy]= "Omega IV")), "Omega V", CALCULATE(COUNTROWS('Data - Unpivot'),FILTER('Data - Unpivot','Data - Unpivot'[Fund - Copy] = "Omega V")), "Omega VI", CALCULATE(COUNTROWS('Data - Unpivot'),FILTER('Data - Unpivot','Data - Unpivot'[Fund - Copy] = "Omega VI")))

 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @Pooji 

You can use “if then else “ in Power Query . For specific content, please refer to the following link .

https://docs.microsoft.com/en-us/powerquery-m/m-spec-conditionals

 

Best Regards

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Pooji
Regular Visitor

Yeah @amitchandak 

 

I am getting error, when am trying to create custom column using the below formula. Please help me in achieving this.

Pooji_0-1633511846182.png

 

amitchandak
Super User
Super User

@Pooji , if this a measure then what you given can work as measure

'Data - Unpivot'[Fund - Copy]

 

If the above is column for measure you need

max('Data - Unpivot'[Fund - Copy]) or selectedvalue('Data - Unpivot'[Fund - Copy])

 

else the above should work as column too

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.