Understanding RANKX with additional fields

@AntrikshSharma,

Ahhhh, OK. This works because this:

Locations Sales GT 0 = 
CALCULATE(
    DISTINCTCOUNTNOBLANK( Sales[Location Code] ),
    FILTER(
        Sales,
        [Total Sales] > 0
    )
) 

evaluates out to 1 for every sales rep.

image

If that weren’t the case, this code would not work as is, and you’d need something like a switch statement to create different TempTables within the measure based on the fields chosen, correct?

Don’t get me wrong – what you’ve done here still super cool, but I thought you had somehow developed a generalizable approach that was magically handling changing granularities.

As always, thanks for the additional explanation.

  • Brian
1 Like