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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tyan
Helper II
Helper II

Test and Measure ( Switch function )

8dddffa1877738ec6c7ca884af3c1c1.png

Hi, I tried to make above table in powerbi.

AD column is by measue : switch( trure(), AB>=7, "yes", "No"))
AE Column is by vlookup from other excel worksheet.  

 

My question is AD is a Measure, and AE is just pure column (TEXT). I would like to get AF Column, which is if both SIZE IN FULL & ON TIME are under YES situation than YES otherwise is NO.

I was wondering how could I write a dax function in BI simialar as I showed in Excel.   I can use 1 and 0 as my yes or no. but I still wondering if is still possible to keep YES/NO to have DIFOT. 

 

Thanks inadvance. 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @tyan ,

 

If AD is a measure, then AF needs to be a measure too.

You could create a new measure for AE then create a measure for AF:

AF = 
var _AE = selectedvalue([AE])

Return
IF([AD] = "Yes"&&_AE = "Yes", "Yes", 0)

If you want a column, then you will need to convert AD as a column.

It looks like the formula you used to create AD measure could be directly converted to a calculated column.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @tyan ,

 

If AD is a measure, then AF needs to be a measure too.

You could create a new measure for AE then create a measure for AF:

AF = 
var _AE = selectedvalue([AE])

Return
IF([AD] = "Yes"&&_AE = "Yes", "Yes", 0)

If you want a column, then you will need to convert AD as a column.

It looks like the formula you used to create AD measure could be directly converted to a calculated column.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@tyan , for looupup , we have lookupvalue

 

Using the column name you can have

new column =

switch( trure(), [AB]>=7, "yes", "No")

 

 

new column =

If([Size in full] ="Yes" && [On Time] ="Yes",1,0)

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

@amitchandak thank you for that, but not sure how come my final step not working. 

tyan_0-1648017940168.png

 

@amitchandak  and i think the reason is new column, so i tried new meassure. but since my AE  is just a text download from excel. is it a meaure.  im not sure how to deal with it. could you give me any method or suggestion on this case? 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.