The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a measure that returns the number of items that make up a given % of sales for a given customer. Visuals using the measure load very slowly...every other visual loads nearly instantly, and this one takes >1 minute. Any tips on ways to clean this up?
NumberOfItems =
VAR TotalSales = CALCULATE( [NetSales], ALL( 'dw dimItem' ) )
VAR ThreesholdPercentage = 0.5
RETURN
COUNTROWS(
FILTER(
CALCULATETABLE(
ADDCOLUMNS(
ADDCOLUMNS(
VALUES( 'dw dimItem'[ItemKey] ),
"TotalSalesOuter", [NetSales]
),
"CumulatedPercentage",
DIVIDE(
SUMX(
FILTER(
ADDCOLUMNS(
VALUES( 'dw dimItem'[ItemKey] ),
"TotalSalesInner", [NetSales]
),
[TotalSalesInner] >= [TotalSalesOuter]
),
[TotalSalesInner]
),
TotalSales
)
),
ALL( 'dw dimItem' )
),
[CumulatedPercentage] <= ThreesholdPercentage
)
)
Solved! Go to Solution.
Hi, @Brotedo
According to your description, When you put this measure in visuals, visuals become slow to load. Right?
Here are a few things you can try to optimize your dax:
(1)Filter the table as early as possible.
(2)Simplify your logic.
(3)Stop using VALUES if you do not have to use them.
You can refer to this document :
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, @Brotedo
According to your description, When you put this measure in visuals, visuals become slow to load. Right?
Here are a few things you can try to optimize your dax:
(1)Filter the table as early as possible.
(2)Simplify your logic.
(3)Stop using VALUES if you do not have to use them.
You can refer to this document :
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Here is everything you need to know to write things like this: ABC classification – DAX Patterns
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |