Forum Discussion

lherbert501's avatar
lherbert501
Icon for Post Prodigy rankPost Prodigy
3 years ago

Rank by second field (latest date)

Hi there,

 

I want to rank the top 5 locations by the amount of calls that come in for each location, but then when the calls are joint, then possibly refer to the most recent on the joint occurences.

 

Is this possible with Dax?

 

I know the below works for a single ranking of singular date, but didn't know how to do both.

 

Rank Measure =
RANKX (
FILTER (
ALL ( 'Fact' ),
[Location] = MAX ( 'Fact'[Location] )
&& [Date] = MAX ( 'Fact'[Date] )
),
CALCULATE ( SUM ( 'Fact'[Value] ) ),
,
)

 

Thanks

 

Liam

2 Replies

  • lherbert501 ,  refer this example of TOPN

     

    2 column top N = CALCULATE( SUM ( 'Fact'[Value] ), TOPN(10, SUMMARIZE(ALLSELECTED('Fact'), 'Fact'[Location], 'Fact'[Date]), CALCULATE ( SUM ( 'Fact'[Value] ) ),DESC),VALUES('Fact'[Location]), VALUES('Fact'[Date]) )

     

    • lherbert501's avatar
      lherbert501
      Icon for Post Prodigy rankPost Prodigy

      Hi amitchandak 

       

      Thanks for your reply.

       

      I've implemented the location and date but it's still displaying as joint 1's like in the image.