Forum Discussion

vazmor's avatar
vazmor
Icon for Helper II rankHelper II
7 years ago
Solved

Rank hyrachy with previus column

Hello, I ask for your help in order to do the following: I have a Matrix as the attachment I need to get the rank based on a brand level but the ranking is from the store. (The attached file is the f...
  • MFelix's avatar
    7 years ago

    Hi vazmor ,

     

    Try to add the following column to your table:

     

    Rank  = 
     CALCULATE(
                    COUNTROWS(Catalogo_Reporte_Diario);
                    FILTER(
                        ALL(Catalogo_Reporte_Diario);
                         Catalogo_Reporte_Diario[Grand_Brand] = EARLIER(Catalogo_Reporte_Diario[Grand_Brand]) &&
                        Catalogo_Reporte_Diario[AMOUNT] < EARLIER(Catalogo_Reporte_Diario[AMOUNT])
                        )
                        )+1

    If you prefer to use a measure try the following:

    Rank = 
    
     CALCULATE(
                    COUNTROWS(Catalogo_Reporte_Diario);
                    FILTER(
                        ALL(Catalogo_Reporte_Diario);
                         Catalogo_Reporte_Diario[Grand_Brand] = SELECTEDVALUE(Catalogo_Reporte_Diario[Grand_Brand]) &&
                        Catalogo_Reporte_Diario[AMOUNT] < SELECTEDVALUE(Catalogo_Reporte_Diario[AMOUNT])
                        )
                        )+1

    Regards,

    MFelix