Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello !
I would like to have dynamic top 5 KDU on visuals - taking into consideration current filtering and also Measure selection (using field parameters and switch function).
It result with bad performance and usually error with not sufficent memory. The Dax which I have tried looks like this:
KDU RANK =
var KDU = ALLSELECTED(Data[KDU])
RETURN
SWITCH(TRUE(),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 0,RANKX(KDU,[Total vs PC]) ,
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 1,RANKX(KDU,[Std Cost vs PC]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 2,RANKX(KDU,[Std vs PC]) ,
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 3,RANKX(KDU,[Std Costs 3rd vs PC]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 4,RANKX(KDU,[company Purchases vs PC]) ,
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 5,RANKX(KDU,[Other vs PC]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 6,RANKX(KDU,[Total Volume vs PC]) ,
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 7,RANKX(KDU,[Total net]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 8,RANKX(KDU,[Std Cost net]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 9,RANKX(KDU,[Std net]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 10,RANKX(KDU,[Std Costs 3rd net]) ,
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 11,RANKX(KDU,[company Purchases net]),
SELECTEDVALUE('Measure Selection'[Measure Selection Order])= 12,RANKX(KDU,[Other net])
)
Any ideas how to use rankx with good performance with dynamic measure selection ?
@KarolDmo , Try like
KDU RANK =
var KDU = ALLSELECTED(Data[KDU])
var _sel = SELECTEDVALUE('Measure Selection'[Measure Selection Order])
var _mes = SWITCH(_sel
,
0, [Total vs PC],
1, [Std Cost vs PC],
2, [Std vs PC],
3, [Std Costs 3rd vs PC],
4, [Company Purchases vs PC],
5, [Other vs PC],
6, [Total Volume vs PC],
7, [Total net],
8, [Std Cost net],
9, [Std net],
10, [Std Costs 3rd net],
11, [Company Purchases net],
12, [Other net]
)
RETURN
RANKX(KDU,_mes)
User | Count |
---|---|
22 | |
14 | |
11 | |
9 | |
6 |
User | Count |
---|---|
23 | |
23 | |
20 | |
15 | |
10 |