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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Marshmallow
Helper I
Helper I

Help with SWITCH Function

hi , not sure if this is the right forum but if  this is the right forum, anyone can help me please. I am stucked with my own measure.....i am trying to create a measure that will display data of the first two column once i type 'yes' in the third column.  

Marshmallow_0-1700697096253.png

at the moment i am using switch(true(),max(table[final answer])="Yes", Max(Table[Organisation_dummy_name]),"")

however when i entered yes, it displays wrong answer...

 

I am expected to see South Australia, General, Diageo PLC in the table below when i entered "Yes" in the Final Answer of the table above (data source)

Marshmallow_0-1700697302343.png

 

Can someone please help :)...I didn't know what's missing 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Marshmallow ,

Below is my new table:

vxiandatmsft_0-1700708662241.png

The new following DAX might work for you:

Measure = 
   var _fina = SELECTEDVALUE('Table'[Final answer])
   var result = 
      IF(_fina == "yes" , MAX('Table'[Organisation_dummy_name])," ")
    return result

The final output is shown in the following figure:

vxiandatmsft_1-1700708709902.png

Best Regards,

Xianda Tang

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

3 REPLIES 3
Marshmallow
Helper I
Helper I

Hi @Xianda, I still would like the row that doesn't have yes to be displayed but not displaying the organisation name. So taking your table as example, if Diageo PLC is not a yes for South Australia and General, it will be displayed as 

South Australia | General | [blank]

Victoria | General | Diageo PLC

 

So whilst waiting for the Final Answer to be yes, I still need to have the State and Type displayed 🙂

 

Anonymous
Not applicable

Hi @Marshmallow ,

Below is my new table:

vxiandatmsft_0-1700708662241.png

The new following DAX might work for you:

Measure = 
   var _fina = SELECTEDVALUE('Table'[Final answer])
   var result = 
      IF(_fina == "yes" , MAX('Table'[Organisation_dummy_name])," ")
    return result

The final output is shown in the following figure:

vxiandatmsft_1-1700708709902.png

Best Regards,

Xianda Tang

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

Anonymous
Not applicable

Hi @Marshmallow ,

Below is my table:

vxiandatmsft_0-1700707572741.png

The following DAX might work for you:

Measure = 
   CALCULATE(
     MAX('Table'[Organisation_dummy_name]),
     FILTER('Table' , 'Table'[Final answer] = "yes"))

The final output is shown in the following figure:

 

vxiandatmsft_1-1700707641468.png

Best Regards,

Xianda Tang

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

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!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.