Forum Discussion
Sumx, Cumulative and blank rows
- 6 years ago
Never had a measure named after me before. Cool. My bad, I meant to use ALL or ALLSELECTED instead of VALUES. With VALUES, every row is in its own Top X. Replace VALUES with ALL and it should work.
Regards,
Pat
I would suggest a measure like this one to get your Top selected and have the total show up as the sum of those.
NewMeasure =
VAR topX = [SelectedTopNValue]
RETURN
CALCULATE (
SUM ( 'CPP POS'[Sales Amount] ),
KEEPFILTERS (
TOPN (
topX,
VALUES ( Grower[Parent Grower] ),
CALCULATE ( SUM ( 'CPP POS'[Sales Amount] ) ), DESC
)
)
)
Also, you can get rid of the extra rows in your Rank measure (if needed) by using an IF.
Rank Show Top X = IF([Rank Measure] <= [SelectedTopNValue], [Rank Measure])
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- Ritesh_Air6 years ago
Post Patron
Thanks. It works for Total but selects everything instead of (say top 3) in below example.
MaHoneyPat = VAR topX = [SelectedTopNValue] RETURN CALCULATE ( SUM ( 'CPP POS'[Sales Amount] ), KEEPFILTERS ( TOPN ( topX, VALUES ( GROWER[CRM_PARENT_GROWER_MASTER_KEY]), CALCULATE ( SUM ( 'CPP POS'[Sales Amount] ) ), DESC ) ) )Thanks,
ritesh
- mahoneypat6 years ago
Microsoft Employee
Never had a measure named after me before. Cool. My bad, I meant to use ALL or ALLSELECTED instead of VALUES. With VALUES, every row is in its own Top X. Replace VALUES with ALL and it should work.
Regards,
Pat
- Ritesh_Air6 years ago
Post Patron
hahaha. I may have to create a separate folder with all of your solutions. 🙂 Much appreciated.
Thanks. It worked like a charm.
Now if we move on to #3 on my original question, why RANK INR, doesn't respect and gives me all the empty rows instead of stopping at how many values have been selected?
Thanks,
ritesh