Forum Discussion
BruceAnderson
7 years agoHelper II
Group Measure values on rows
I have a simple sales table per customer. Customer No | Customer Disc Group | Sales Amt I need to show a table in Power BI based on it, showing the ranking but in groups. 1-20% 1,54...
- 7 years ago
hi,@BruceAnderson
After my research, Whether you have used slicer to filter data like below:
before
After
IF so, you need to use ALLSELECTED Function and ALLEXCEPT Function in the measure like this
Measure 2 =
var a=ADDCOLUMNS(Sales_analysis,"r",RANKX (
ALLSELECTED(Sales_analysis[Customer No]),
CALCULATE(SUM(Sales_analysis[Sales Amt]),ALLEXCEPT(Sales_analysis,Sales_analysis[Customer No])),
,
0,
DENSE
)) return
var _table=FILTER(GENERATE(a,'Ranking Buckets'),[r]>='Ranking Buckets'[Start]&&[r]<='Ranking Buckets'[End]) return
CALCULATE(SUMX(_table,[Sales Amt]))Result:
Best Regards,
Lin
v-lili6-msft
7 years agoCommunity Support
hi,@BruceAnderson
After my research, you can do these follow my steps as below
Step1:
add a measure like below
Measure =
var a=ADDCOLUMNS(Sales_analysis,"r",RANKX (
ALL (
Sales_analysis
),
CALCULATE(SUM(Sales_analysis[Sales Amt])),
,
0,
DENSE
)) return
var _table=FILTER(GENERATE(a,'Ranking Buckets'),[r]>='Ranking Buckets'[Start]&&[r]<='Ranking Buckets'[End]) return
CALCULATE(SUMX(_table,[Sales Amt]))Step2:
Drag field rank and this measure into table visual
Result:
Basic data
then
here is pbix, please try it.
https://www.dropbox.com/s/5gejki6x0fg2ffc/Group%20Measure%20values%20on%20rows.pbix?dl=0
Best Regards,
Lin
BruceAnderson
7 years agoHelper II
Many thanks for that Lin!
I will give it a try.