Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Dear all, good morning.
I have a measure I would like to use in my reports but this is taking extremly long to show the visuals. I have a table called Support Category Table and this would have the categories A,B,C and its lower and upper boundaries, thad define in which category a customer should fall into, based on its Revenue or Profit (this specific measure is for profit but I amd oing the same for revenue)
Currently, this would be my measure:
Solved! Go to Solution.
Hey there!
Your DAX measure performance issue comes from using CALCULATETABLE, CROSSJOIN, and FILTER extensively, which can be resource-intensive. Here's a solution for you:
Instead of CROSSJOIN(SalesByProduct, 'Support_CategoryTable'), which generates all possible combinations, use a direct lookup.
category_abcByCumulativeProfit_Profit =
VAR CY_Quarters =
CALCULATE(
DISTINCTCOUNT('Calendar'[Quarter & Year]),
ALLSELECTED(Fact_JobFinancials),
Fact_JobFinancials[CalendarDate] <= MAX(Fact_JobFinancials[CalendarDate])
)
VAR TotalProfit =
CALCULATE(
[job_cumulative_totalProfitUSD/EUR],
ALLSELECTED(Fact_JobFinancials)
)
VAR SelectedCategory =
LOOKUPVALUE(
'Support_CategoryTable'[Category],
'Support_CategoryTable'[ProfitLowerBoundaries], "<=", TotalProfit / CY_Quarters,
'Support_CategoryTable'[ProfitUpperBoundaries], ">=", TotalProfit / CY_Quarters
)
RETURN
SelectedCategory
Hopefully this will make faster performance as unnecessary row-by-row filtering is eliminated and accurate category assignment based on cumulative profit and support category table.
Hope this helps!
😁😁
Hey there!
Your DAX measure performance issue comes from using CALCULATETABLE, CROSSJOIN, and FILTER extensively, which can be resource-intensive. Here's a solution for you:
Instead of CROSSJOIN(SalesByProduct, 'Support_CategoryTable'), which generates all possible combinations, use a direct lookup.
category_abcByCumulativeProfit_Profit =
VAR CY_Quarters =
CALCULATE(
DISTINCTCOUNT('Calendar'[Quarter & Year]),
ALLSELECTED(Fact_JobFinancials),
Fact_JobFinancials[CalendarDate] <= MAX(Fact_JobFinancials[CalendarDate])
)
VAR TotalProfit =
CALCULATE(
[job_cumulative_totalProfitUSD/EUR],
ALLSELECTED(Fact_JobFinancials)
)
VAR SelectedCategory =
LOOKUPVALUE(
'Support_CategoryTable'[Category],
'Support_CategoryTable'[ProfitLowerBoundaries], "<=", TotalProfit / CY_Quarters,
'Support_CategoryTable'[ProfitUpperBoundaries], ">=", TotalProfit / CY_Quarters
)
RETURN
SelectedCategory
Hopefully this will make faster performance as unnecessary row-by-row filtering is eliminated and accurate category assignment based on cumulative profit and support category table.
Hope this helps!
😁😁
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
37 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |