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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Conditional relationship for multiple tables

Hi, 

 

I have 4 tables 

 

logins, ConnectedUsers,FacilityCode, ProviderCode.   

 

Basically in ConnectedUsers table i have: 

Provider_NameSystem_CodeFacility_CodeRegisteredUsers
AHSEGAYA 10
CCMSGAYAAA024
AHSEGAYA 6

logins

EventIDSystem_CodeFacility_Code
01GAYAAA02
02GAYA 

I have a measure that calculates logins based on event ID (count), however, I want the system to check if facility code in connectedusers table is blank then it should take system_code  registered users.

4 REPLIES 4
lbendlin
Super User
Super User

If you want to be cute you can rewrite

 

IF(ISBLANK( [Facility_Code]) ,[System_Code], [Facility_Code] )

 

as

 

COALESCE ( [Facility_Code]) ,[System_Code] )

 

but I'm not sure it would make any difference in performance.


but I'm not sure it would make any difference in performance.

No, they are identical in terms of performance producing identical query plans. COALESCE is just syntactic sugar over the IF( ISBLANK() ...) format

d_gosbell
Super User
Super User

Well, I think you could do it in DAX by creating a calculated column in the connected users table something like:

IF(ISBLANK( [Facility_Code]) ,[System_Code], [Facility_Code] )

and then create your relationship on that column. But personally I would typically try and do row level calculations like this in PowerQuery or a source view if I can. It's not such a big deal on most tables if you are only dealing with a few million rows or less. See here https://www.sqlbi.com/articles/comparing-dax-calculated-columns-with-power-query-computed-columns/ for a discussion of the pro/cons of the two approaches and why it often does not matter.

lbendlin
Super User
Super User

You can't do that in DAX but you can merge tables in PowerQuery based on fuzzy logic like yours. Look at the custom Column Generator function in Table.AddColumn() .

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.