cancel
Showing results for 
Search instead for 
Did you mean: 
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
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors