Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Showing Different Ranks on Cards

Hi,

I've been wrestling with different possible solutions to this (what I assume will be a simple issue).

 

I have the below table

The conversion rank is via a measure:

Conversion Rank =
var sourcetable =
ADDCOLUMNS(
    ALLSELECTED(
        'NBEs'[Handler]),
    "@Con",
    'NBEs'[% of NBE Accepted])
var result =
RANK(
    DENSE,
    sourcetable,
    ORDERBY(
        [@Con],
        DESC,
        'NBEs'[% of NBE Accepted],
        ASC))
RETURN
result
 
I want to show 3 cards for 1st, 2nd & 3rd.
I've got the top handler using the following:
#1 Handler =
VAR vSummary =
        ADDCOLUMNS ( VALUES ( NBEs[Handler] ), "cTS", [Conversion Rank] )
RETURN
    MAXX (
        TOPN ( 1, vSummary, [cTS], ASC ),
        NBEs[Handler]
    )
 
But I'm struggling with places 2 & 3. How would I be able to show these on separate cards?
  • Anonymous's avatar
    Anonymous
    1 year ago

    Managed to solve my own issue on this!:-

    #2 Handler =
    VAR CurrentMonthStart = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
    VAR CurrentMonthEnd = EOMONTH(CurrentMonthStart, 0)
    VAR FilteredHandlers =
        FILTER (
            VALUES ( NBEs[Handler] ),
            CALCULATE (
                COUNTROWS ('NBEs' ),
                NBEs[DateReceived] >= CurrentMonthStart &&
                NBEs[DateReceived] <= CurrentMonthEnd
            ) >= 10
        )
    VAR vSummary =
        ADDCOLUMNS ( FilteredHandlers, "cTS", [Conversion Rank] )
    VAR Top2 = TOPN ( 2, vSummary, [cTS], ASC )
    VAR SecondOnly = EXCEPT ( Top2, TOPN ( 1, vSummary, [cTS], ASC ) )
    RETURN
        MAXX ( SecondOnly, NBEs[Handler] )

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Managed to solve my own issue on this!:-

    #2 Handler =
    VAR CurrentMonthStart = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
    VAR CurrentMonthEnd = EOMONTH(CurrentMonthStart, 0)
    VAR FilteredHandlers =
        FILTER (
            VALUES ( NBEs[Handler] ),
            CALCULATE (
                COUNTROWS ('NBEs' ),
                NBEs[DateReceived] >= CurrentMonthStart &&
                NBEs[DateReceived] <= CurrentMonthEnd
            ) >= 10
        )
    VAR vSummary =
        ADDCOLUMNS ( FilteredHandlers, "cTS", [Conversion Rank] )
    VAR Top2 = TOPN ( 2, vSummary, [cTS], ASC )
    VAR SecondOnly = EXCEPT ( Top2, TOPN ( 1, vSummary, [cTS], ASC ) )
    RETURN
        MAXX ( SecondOnly, NBEs[Handler] )