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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
adoalan
Helper III
Helper III

Case when in Power BI

I have this SQL code and I need to convert this in a dax in Power BI 

Can I get some help:

adoalan_0-1668506909790.png

 

Thank you

 

2 ACCEPTED SOLUTIONS

@adoalan you're missing two brackets "))" after "...Street1])" and after "...PostalCode])"

View solution in original post

@adoalan 
You are missing the brackets :- 

Can you just try this :-

 

Valldata Fix = IF(nfp_giftaiddeclaration[cratedbyyominame] = "Valldata" && ISBLANK(nfp_giftaiddeclaration[House])
&& ISBLANK(nfp_giftaiddeclaration[Postcode]) && NOT(ISBLANK(RELATED(contact[Address 1: Street 1]))) && NOT(ISBLANK(RELATED(contact[Address 3: ZIP/Postal Code]))), "Y", "N")

 

 

View solution in original post

10 REPLIES 10
JorgePinho
Solution Sage
Solution Sage

Hello @adoalan !

 

Create a dax column using this:

 

Valldata Fix = IF( gad.createdbyname = "Valldata" && ISBLANK(gad.nfp_declaredhouse) &&  ISBLANK(gad.nfp_declaredpostcode) && NOT(ISBLANK(c.adress1_line1)) && NOT(ISBLANK(c.adress1_postalcode)), "Y", "N")

 

 

 

@JorgePinho this works half for me. So the c.address1_line1 is coming from a different table called contact and it is not popping up when search. Can you help here?

adoalan_0-1668508698682.png

 

Are the tables connected?

Yes, 

adoalan_0-1668510655034.png

 

Thank you 

 

Try to use RELATED function to bring that column value. https://learn.microsoft.com/en-us/dax/related-function-dax

Jorge, not sure how to do that. CAn you give me an exmple?

 

Hi @adoalan!
You have to create the calculated column like this :-

 

Valldata Fix = IF( gad.createdbyname = "Valldata" && ISBLANK(gad.nfp_declaredhouse) && ISBLANK(gad.nfp_declaredpostcode) && NOT(ISBLANK(c.adress1_line1)) && NOT(ISBLANK(RELATED(c.adress1_postalcode))), "Y", "N")

I got up to here but still an error

adoalan_1-1668512354278.png

 

 

@adoalan 
You are missing the brackets :- 

Can you just try this :-

 

Valldata Fix = IF(nfp_giftaiddeclaration[cratedbyyominame] = "Valldata" && ISBLANK(nfp_giftaiddeclaration[House])
&& ISBLANK(nfp_giftaiddeclaration[Postcode]) && NOT(ISBLANK(RELATED(contact[Address 1: Street 1]))) && NOT(ISBLANK(RELATED(contact[Address 3: ZIP/Postal Code]))), "Y", "N")

 

 

@adoalan you're missing two brackets "))" after "...Street1])" and after "...PostalCode])"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors