Forum Discussion
TOPN sort order with USERELATIONSHIP
- 4 years ago
Hi jthomson ,
You want to add Userelationship to sumofthat?
If yes, please try add CALCULATETABLE() to the TOPN()'s table, second parameter.
Top2% = VAR claims = CALCULATE( COUNTROWS( dcl ), USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] ) ) VAR top2calc = CALCULATE( ROUNDDOWN( DIVIDE( claims, 50 ), 0 ), USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] ) ) VAR sumofthat = SUMX( TOPN( 2, CALCULATETABLE( 'dcl', USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] ) ), [total incurred], DESC ), [total incurred] ) RETURN DIVIDE( sumofthat, top2calc )If i misunderstood you, please share your pbix file without sensitive data and expect result.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi jthomson ,
You want to add Userelationship to sumofthat?
If yes, please try add CALCULATETABLE() to the TOPN()'s table, second parameter.
Top2% =
VAR claims =
CALCULATE(
COUNTROWS( dcl ),
USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] )
)
VAR top2calc =
CALCULATE(
ROUNDDOWN( DIVIDE( claims, 50 ), 0 ),
USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] )
)
VAR sumofthat =
SUMX(
TOPN(
2,
CALCULATETABLE( 'dcl', USERELATIONSHIP ( DateTable[Date], dcl[Settled Date] ) ),
[total incurred], DESC
),
[total incurred]
)
RETURN
DIVIDE( sumofthat, top2calc )
If i misunderstood you, please share your pbix file without sensitive data and expect result.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.