Forum Discussion
Anonymous
2 years agoNot applicable
Summarizing a table to align most recent dates
I've been unable to find/figure out how to summarize a table such that the data is aligned by most recent month, prior month, prior month -1, etc. My goal is to be able to select the primary source ...
- 2 years ago
Anonymous ,
Sorry, I misunderstood your needs before. You can try below measure.
(I can't very well restore your real date due to date formatting issues, so the results may change, but the logic should be correct.)
Measure:
Primary Source = IF(HASONEFILTER('Fact'[Branch]), CALCULATE( VAR tempTable = SUMMARIZE('Fact','Fact'[source ],"Recent3MonthsTotal",SUM('Fact'[qty])) VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal]) RETURN MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source ]), TOPN(3,VALUES('Fact'[month]),'Fact'[month]) ) )Table Expression:
Table Name = ADDCOLUMNS ( ALL ( 'Fact'[Branch] ), "Parimay Source", CALCULATE( CALCULATE( VAR tempTable = SUMMARIZE('Fact','Fact'[source ],"Recent3MonthsTotal",SUM('Fact'[qty])) VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal]) RETURN MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source ]), TOPN(3,VALUES('Fact'[month]),'Fact'[month]) ) ) )
Anonymous
2 years agoNot applicable
xifeng_L Thank you -- I'll check this out asap!
Anonymous
2 years agoNot applicable
Your solutions is great xifeng_L
Hi, Anonymous
Have you solved your problem? If so, can you share your solution here or mark the correct answer as a standard answer to help other members find it faster. Thank you very much for your kind cooperation!
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li