arnabmit
New Member
- Joined
- Mar 28, 2009
- Messages
- 27
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I was trying to get the sum of the bottom 20% values, then show it by year. However, the DAX returned the total value.
Then as per some suggestion, I introduced another set of iterators. This time, it returned the sum of bottom 20%. However, it still was not working properly when trying to group by years.
For example, if I am trying to check for say 60% instead of 20%, and group them by year, The ranking is not working for the group, but the entire range.
Can anyone please help me understand what I am doing wrong? Thanks in advance!
PBIX
Code:
Bottom 20% Values =
VAR BV = ROUND(COUNTROWS(Sheet1) * 0.2,0)
VAR DR = RANKX(ALL(Sheet1),CALCULATE(SUM(Sheet1[Value])),,DESC,Skip)
RETURN
IF(DR <= BV, CALCULATE(SUM(Sheet1[Value])),BLANK())
Then as per some suggestion, I introduced another set of iterators. This time, it returned the sum of bottom 20%. However, it still was not working properly when trying to group by years.
Code:
Bottom 20% Values =
VAR BV = ROUND(COUNTROWS(ALL('Sheet')) * 0.2,0)
RETURN
SUMX(
'Sheet',
VAR DR = RANKX(ALL('Sheet'),CALCULATE(SUM('Sheet'[Value])),,ASC,Skip)
RETURN IF(DR<=BV,'Sheet'[Value],0)
)
For example, if I am trying to check for say 60% instead of 20%, and group them by year, The ranking is not working for the group, but the entire range.
Can anyone please help me understand what I am doing wrong? Thanks in advance!
PBIX