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.
Hi all,
I am working with a large semantic model with about 10M records. The data quality is not the best.
My data model involves cars and car parts (imaginary). The grain for my fact table is on the parts level. The problem is for my column of interest, with the grain of parts (preferred) values are frequently blank. When it is blank, I want logic to pull the value from the dimension table, that is related on the car level (less desired, but better than blank). I have following measure devised for this:
VAR SelectedAnalysisType = SELECTEDVALUE('Total Inventory'[Type])
VAR SelectedCategory = SELECTEDVALUE('Total Inventory'[Hoods], BLANK())
VAR SelectedType = SELECTEDVALUE(Cars[Hoods])
RETURN
IF (
SelectedAnalysisType = "Pontiac",
IF (
SelectedTissueCategory = BLANK(),
SelectedType,
SelectedCategory
),
BLANK()
)
However, this measure is very slow when I add it to a table visual, and can take up to 10 seconds to load 10s of thousands of records. Any ideas how to optimize this? The rest of my data model is lightning fast. Another idea is using mQuery but is less desired, since it would likely require a join and I prefer to keep these tables separate.
Solved! Go to Solution.
If the fallback logic (SelectedType when SelectedCategory is blank) is static, consider adding a calculated column in the fact table. This will avoid runtime computation:
PreferredCategory =
IF (
ISBLANK('Total Inventory'[Hoods]),
RELATED(Cars[Hoods]),
'Total Inventory'[Hoods]
)
Then, in your measure, directly reference this column instead of recalculating it:
Optimized Measure with Column =
VAR SelectedAnalysisType = SELECTEDVALUE('Total Inventory'[Type])
RETURN
IF (
SelectedAnalysisType = "Pontiac",
SELECTEDVALUE('Total Inventory'[PreferredCategory]),
BLANK()
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
If the fallback logic (SelectedType when SelectedCategory is blank) is static, consider adding a calculated column in the fact table. This will avoid runtime computation:
PreferredCategory =
IF (
ISBLANK('Total Inventory'[Hoods]),
RELATED(Cars[Hoods]),
'Total Inventory'[Hoods]
)
Then, in your measure, directly reference this column instead of recalculating it:
Optimized Measure with Column =
VAR SelectedAnalysisType = SELECTEDVALUE('Total Inventory'[Type])
RETURN
IF (
SelectedAnalysisType = "Pontiac",
SELECTEDVALUE('Total Inventory'[PreferredCategory]),
BLANK()
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
not perfect but a definite improvement
@shuhn1229 Try:
VAR SelectedAnalysisType = SELECTEDVALUE('Total Inventory'[Type])
RETURN
IF (
SelectedAnalysisType = "Pontiac",
IF (
SelectedTissueCategory = BLANK(),
SELECTEDVALUE(Cars[Hoods]),
SELECTEDVALUE('Total Inventory'[Hoods], BLANK())
),
BLANK()
)
Want to mention I tried using GPT for this with limited success and I cannot get the COALESCE function working well with this for some reason.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.