Forum Discussion

Sirhawk3017's avatar
Sirhawk3017
Icon for Helper II rankHelper II
1 year ago
Solved

Power BI: Need Help Creating Quarterly Rank and Quartiles

I need help creating quartiles in Power BI based on a quarterly rank, but I don't have the ranking measure yet. I want to:

  1. Create a measure that ranks my sales data each quarter
  2. Divide my data into four quartiles (Quartile 1 being the top, Quartile 4 the bottom) based on this newly created quarterly rank.
  3. Display the average of the ranked numerical field for each quartile in separate card visuals above a table. The table should show the detailed data, including the quarter, the numerical field, the quarterly rank, and the quartile assignment.

https://www.dropbox.com/scl/fi/2sl3smvho66hzikdmjath/Need-Help-Quartiles.pbix?rlkey=hz8yuj76r62oz07d1smr283xw&st=nyu3do10&dl=0

 

 

  • tried this formula and seemed to work; 

     

    Quartile =
    VAR RankedTable =
        ADDCOLUMNS(
            ALL(Medic_Info),
            "Rank", [FM Sales QTD Rank]  // Add a temporary rank column
        )
    VAR MaxRank = MAXX(RankedTable, [Rank])  // Get the max rank from the temporary table
    VAR QuartileSize = CEILING(MaxRank / 4, 1)
    RETURN
        SWITCH(
            TRUE(),
            [FM Sales QTD Rank] <= QuartileSize, 1,
            [FM Sales QTD Rank] <= QuartileSize * 2, 2,
            [FM Sales QTD Rank] <= QuartileSize * 3, 3,
            4
        )

2 Replies

  • tried this formula and seemed to work; 

     

    Quartile =
    VAR RankedTable =
        ADDCOLUMNS(
            ALL(Medic_Info),
            "Rank", [FM Sales QTD Rank]  // Add a temporary rank column
        )
    VAR MaxRank = MAXX(RankedTable, [Rank])  // Get the max rank from the temporary table
    VAR QuartileSize = CEILING(MaxRank / 4, 1)
    RETURN
        SWITCH(
            TRUE(),
            [FM Sales QTD Rank] <= QuartileSize, 1,
            [FM Sales QTD Rank] <= QuartileSize * 2, 2,
            [FM Sales QTD Rank] <= QuartileSize * 3, 3,
            4
        )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,Sirhawk3017 .
    Congratulations!
    It's great to see that you solved your problem and that you shared the method to the forum.