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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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