Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a dashboard with the following limitations:
Example measure:
measure_1 =
VAR PeriodSelection = SELECTEDVALUE( same_store_filter[Value] )
VAR Result =
IF( PeriodSelection = "All Stores",
CALCULATE (
SUM( fact_performancesummary[unitcapacitycnt] ),
fact_performancesummary[resettimingdesc] IN VALUES ( compare_case_1[resettimingdesc] )
),
CALCULATE (
SUM( fact_performancesummary[unitcapacitycnt] ),
fact_performancesummary[resettimingdesc] in VALUES(compare_case_1[resettimingdesc]),
dim_same_store_status[resettimingdesc_2] in VALUES(compare_case_2[resettimingdesc])
)
)
RETURN Result
Problem:
Example:
_flag = DIVIDE([measure_1],[measure_2],-1)
Conditional Formatting:
Visual:
I'm looking for ways to efficiently display a text-based flag that the user can export.
Solved! Go to Solution.
Hi @mkinde , Thank you for reaching out to the Microsoft Community Forum.
We find the answer posted by @lbendlin appropriate for your issue. Making it more detailed, the issue you're facing arises from the cost of evaluating conditional logic per row in visuals, especially when you're stacking multiple measures and using filtering patterns like IN. This causes performance degradation at scale. To solve this without compromising performance or exportability, follow one of these structures based on your scenario:
If the flag logic can be applied before user interaction (for example, if time periods are fixed or predictable), push it into Power Query. This approach is fully exportable and incurs no runtime cost:
if [Current Capacity] = null and [Prior Capacity] <> null then "Deleted"
else if [Current Capacity] <> null and [Prior Capacity] = null then "Added"
else "Maintained"
If the logic depends on slicers and must be calculated live, use TREATAS instead of IN. This efficiently passes filter context and avoids nested IFs:
Flag =
VAR Period1 = VALUES(compare_case_1[resettimingdesc])
VAR Period2 = VALUES(compare_case_2[resettimingdesc])
VAR Current = CALCULATE(SUM(fact_performancesummary[unitcapacitycnt]), TREATAS(Period1, fact_performancesummary[resettimingdesc]))
VAR Prior = CALCULATE(SUM(fact_performancesummary[unitcapacitycnt]), TREATAS(Period2, dim_same_store_status[resettimingdesc_2]))
RETURN
SWITCH
( TRUE(),
ISBLANK(Current) && NOT ISBLANK(Prior), "Deleted",
NOT ISBLANK(Current) && ISBLANK(Prior), "Added",
"Maintained"
)
If you're already using a performant _flag = DIVIDE([measure_1], [measure_2], -1) pattern to drive icons and just need an exportable version, avoid reintroducing complex logic. Simply map the _flag value to a text column or measure:
ExportFlag =
SWITCH(
TRUE(), [_flag] = -1, "Deleted",
[_flag] > 0, "Maintained",
ISBLANK([_flag]) || [_flag] = 0, "Added"
)
This keeps performance intact and provides the user with a clean, exportable text-based flag.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @mkinde , Thank you for reaching out to the Microsoft Community Forum.
We find the answer posted by @lbendlin appropriate for your issue. Making it more detailed, the issue you're facing arises from the cost of evaluating conditional logic per row in visuals, especially when you're stacking multiple measures and using filtering patterns like IN. This causes performance degradation at scale. To solve this without compromising performance or exportability, follow one of these structures based on your scenario:
If the flag logic can be applied before user interaction (for example, if time periods are fixed or predictable), push it into Power Query. This approach is fully exportable and incurs no runtime cost:
if [Current Capacity] = null and [Prior Capacity] <> null then "Deleted"
else if [Current Capacity] <> null and [Prior Capacity] = null then "Added"
else "Maintained"
If the logic depends on slicers and must be calculated live, use TREATAS instead of IN. This efficiently passes filter context and avoids nested IFs:
Flag =
VAR Period1 = VALUES(compare_case_1[resettimingdesc])
VAR Period2 = VALUES(compare_case_2[resettimingdesc])
VAR Current = CALCULATE(SUM(fact_performancesummary[unitcapacitycnt]), TREATAS(Period1, fact_performancesummary[resettimingdesc]))
VAR Prior = CALCULATE(SUM(fact_performancesummary[unitcapacitycnt]), TREATAS(Period2, dim_same_store_status[resettimingdesc_2]))
RETURN
SWITCH
( TRUE(),
ISBLANK(Current) && NOT ISBLANK(Prior), "Deleted",
NOT ISBLANK(Current) && ISBLANK(Prior), "Added",
"Maintained"
)
If you're already using a performant _flag = DIVIDE([measure_1], [measure_2], -1) pattern to drive icons and just need an exportable version, avoid reintroducing complex logic. Simply map the _flag value to a text column or measure:
ExportFlag =
SWITCH(
TRUE(), [_flag] = -1, "Deleted",
[_flag] > 0, "Maintained",
ISBLANK([_flag]) || [_flag] = 0, "Added"
)
This keeps performance intact and provides the user with a clean, exportable text-based flag.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
This has really helped me understand some of the underlying issues. The visuals are faster and have more rows available to the user. Thanks!
1. use variables, but they are mainly useful if they are referenced more than once in a query plan.
2. Compare the "IN" performance with the "TREATAS" performance
3. Remember the 5/50K/1M limits.
The user is definitely not using the tool as designed. I was able to use your info and pair it with the CST. Thanks!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |