Forum Discussion
DAX Ranking within Group
- Anonymous2 years ago
Hi KartikWatt ,
Please refer to my pbix file to see if it helps you.
Create 2 measures.
Measure = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Store Name] = SELECTEDVALUE ( 'Table'[Store Name] ) ), 'Table'[Revenue] )Measure2 = VAR _1 = RANKX ( ALL ( 'Table' ), CALCULATE ( [Measure] ),, desc, DENSE ) RETURN IF ( MAX ( 'Table'[weekday] ) = _1, _1, BLANK () )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
Community Support Team _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
KartikWatt You can try the SUMMARIZECOLUMNS function to group the data based on two columns: 'Store Name' and 'WeekDayName'. This creates a table with distinct combinations of these two columns.
SummaryTable =
SUMMARIZECOLUMNS (
'SampleData'[Store Name],
'SampleData'[WeekDayName],
"Net Sales", SUM('SampleData'[Revenue])
)
=============OR
DistinctTable =
ADDCOLUMNS(
SUMMARIZE(
'SampleData',
'SampleData'[WeekDayName],
'SampleData'[Store Name]
),
"Net Sales", SUM('Table'[Revenue])
)
Please let me know if that helps.
Thanks