Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear PBI Oracles,
I have a table consisting of some items named cItem with four belonging measures. I'm trying to calculate a running average of mAdjustPickRatio in a measure named mCumMeanAdjustPickRatio - based on their rank of the measure mRankAvgPickSize.
As I'm calculating an average of an existing average measure (mAdjustPickRatio), I'm sadly forced to use AVERAGEX. As demonstrated with the red box, for row/rank 11, I want the running average of all items less or equal to rank 11.
However, the problem is that using AVERAGEX or SUMX in combination with FILTER, is very slow (two minutes or so), although I only have a thousand rows. I've tried following two measures:
mCumMeanAdjustPickRatio = VAR MyData = SUMMARIZE(ALLSELECTED(ITEM_DIM[cItem]);ITEM_DIM[cItem];"AvgPick";[mAvgPickSize];"AdjustPick";[mAdjustPickRatio];"Rank";[mRankAvgPickSize]) VAR CurrentRank = [mRankAvgPickSize] RETURN AVERAGEX( FILTER(MyData;[Rank]<=CurrentRank) ;[AdjustPick] )
And:
mCumMeanAdjustPickRatio2 = VAR CurrentRank = [mRankAvgPickSize] RETURN AVERAGEX( CALCULATETABLE( FILTER( ALLSELECTED(ITEM_DIM[cItem]);[mRankAvgPickSize]<=CurrentRank)) ;[mAdjustPickRatio] )
Both really slow.
The issue with AVERAGEX and SUMX, in combination with FILTER, is that is loops over the same data, and thus calculate a new table for each row, although I tried to make a constant table with VAR in example 1.
How can I fix this insane slow formula?
You may take a look at https://www.sqlbi.com/topics/optimization/.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |