Forum Discussion

orangeatom's avatar
orangeatom
Resolver I
8 years ago
Solved

Measure using RANKX across different tables

Hello, I need some help. I have 3 dimension tables (Region, DollarType, Year and Month (for year to date)) and a fact table (Sales). I have been trying to find a solution to get the top 5 customers a...
  • orangeatom's avatar
    orangeatom
    8 years ago

    Hello v_ljerr_msft,

     

    After a few hours, i piggy packed my solution based on this thread

     

    [https://community.powerbi.com/t5/Desktop/Calculating-SUM-of-TOPN-rows/td-p/59602].

     

    The only difference is that i used SUMMARIZECOLUMNS function to gather all the fields i required to complete the calculation. I also added one Measure at the end that divides the sum of positive customers / TopN value. 

     

    Below are my steps to delivering this: 

     

    //Table - Create table mining all the columns required
    //Column - Create flag for positive/negative growth YoY
    //Measure - Create measure for Sales Prior 12 Month Rolling
    //Create lookup table for selecting TopN
    //Measure - Select TopN
    //Measure - Rank Customers

    //Measure - Sum all flags
    //Measure - Rank Customers based on region
    //Measure - Sum of all flags based on region/topn/and selected month
    //Measure - Filter Matrix only showing records with TopN
    //Measure - Calculate the ratio
    //Measure - Set target ratio
    Visual KPI + Matrix