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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.