Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
First, create two base measures that return blank when there are no rows in their respective tables.
Example:
Avg Fixed Rate =
VAR rows = CALCULATE(COUNTROWS(fixed_hourly_rate))
RETURN
IF(rows = 0, BLANK(), AVERAGEX(fixed_hourly_rate, fixed_hourly_rate[hourly_rate]))
Avg Package Rate =
VAR rows = CALCULATE(COUNTROWS(package_hourly_rate))
RETURN
IF(rows = 0, BLANK(), DIVIDE(SUM(package_hourly_rate[amount]), SUM(package_hourly_rate[hours])))
Then create the combined measure that takes the first non-blank result.
Hourly Sale Rate =
COALESCE([Avg Fixed Rate], [Avg Package Rate])
This way, each employee row in the matrix will show whichever rate exists for that employee.
If you need correct totals (for example an average across all employees), use this version instead:
Hourly Sale Rate Total =
VAR t =
ADDCOLUMNS(
VALUES(employee_category[employee_id]),
"rate", COALESCE([Avg Fixed Rate], [Avg Package Rate])
)
RETURN
AVERAGEX(t, [rate])
If your central table contains a field specifying which type of rate applies, you can use this logic instead:
Hourly Sale Rate =
VAR src=SELECTEDVALUE(employee_category[rate_source])
RETURN
SWITCH(src,
"Fixed", [Avg Fixed Rate],
"Package", [Avg Package Rate],
BLANK()
)
Make sure relationships flow correctly from employee_category to both rate tables so that the filter context works as expected. If any relationship is inactive, activate it with USERELATIONSHIP inside your base measures.