Forum Discussion

TJ's avatar
TJ
New Member
8 years ago
Solved

Need Help

Hello, I need some help solving the below requirement.   I have Fact table like below. Quater   ProductCategory  ProductSubCategory Platform  GameType Region PublisherName ...
  • v-sihou-msft's avatar
    8 years ago

    TJ

     

    Firstly, you need to create a rank calculated column like below: 

     

    Title Rank =
    RANKX (
        ALL ( Table2[Title ] ),
        CALCULATE ( SUM ( Table2[Revenue] ), ALLEXCEPT ( Table2, Table2[Title ] ) ),
        ,
        DESC,
        DENSE
    )

    Then you can add a "percentage" column like: 

     

    Pct =
    Table2[Title Rank]
        / CALCULATE ( DISTINCTCOUNT ( Table2[Title] ), ALL ( Table2 ) )

    Use SWITCH() to assign each "bucket": 

     

    Bucket =
    SWITCH (
        TRUE (),
        Table[Pct] > 0
            && Table[Pct] <= 0.2, "Top20%",
        Table[Pct] > 0.2
            && Table[Pct] <= 0.4, "21%-40%",
        Table[Pct] > 0.4
            && Table[Pct] <= 0.6, "41%-60%",
        Table[Pct] > 0, 6
            && Table[Pct] <= 1,
        "61%-100%"
    )

    Now you just put above Bucket column and Revenue column into Table visual to get your expected result. 

     

    Regards,