Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Ranking Without any aggregate expression

Hi Power BI Gurus,

I have below set of data 

 

Customer IdCalendar DateSale IdStanding Order Id
12314-NOV-13 00:00:001526471765911674594922
12305-DEC-13 00:00:001528509907011674594922
12316-DEC-13 00:00:001529203629411674594922
12303-JAN-14 00:00:001530180301715474692288
12317-JAN-14 00:00:001531266056615474692288
12331-JAN-14 00:00:001532469647915474692288
12314-FEB-14 00:00:001533759277715474692288
12328-FEB-14 00:00:001534917049415474692288
12314-MAR-14 00:00:001536146173815474692288

 

 

Now I want an additionla column say SO Instance with value like below, its almost ranking Customer on the base of its SO ID ,Sale ID and Calendar Date

 

Customer IdCalendar DateSale IdStanding Order IdSO Instance
12314-NOV-13 00:00:0015264717659116745949221
12305-DEC-13 00:00:0015285099070116745949222
12316-DEC-13 00:00:0015292036294116745949223
12303-JAN-14 00:00:0015301803017154746922881
12317-JAN-14 00:00:0015312660566154746922882
12331-JAN-14 00:00:0015324696479154746922883
12314-FEB-14 00:00:0015337592777154746922884
12328-FEB-14 00:00:0015349170494154746922885
12314-MAR-14 00:00:0015361461738154746922886

 

The data has mumtiple customer IDs with respective Sae and SO IDs.

 

Appreciate yor help in this.

 

Thanks

Swapnil

  • Hi Anonymous

     

    Try this calculated column

    What is the role of Sale ID in RANKING?

     

    SO_Instance =
    RANKX (
        FILTER (
            ALL ( TableName ),
            TableName[Customer Id] = EARLIER ( TableName[Customer Id] )
                && TableName[Standing Order Id] = EARLIER ( TableName[Standing Order Id] )
        ),
        TableName[Calendar Date],
        ,
        Asc,
        DENSE
    )

5 Replies

    • Zubair_Muhammad's avatar
      Zubair_Muhammad
      Community Champion

      Hi Anonymous

       

      Try this calculated column

      What is the role of Sale ID in RANKING?

       

      SO_Instance =
      RANKX (
          FILTER (
              ALL ( TableName ),
              TableName[Customer Id] = EARLIER ( TableName[Customer Id] )
                  && TableName[Standing Order Id] = EARLIER ( TableName[Standing Order Id] )
          ),
          TableName[Calendar Date],
          ,
          Asc,
          DENSE
      )

      • Anonymous's avatar
        Anonymous
        Not applicable

        Great it worked like charm... but not surehow ?

        May I have to read more article about Earlier...do you have any that explains in detail

         

        Thanks

        Swapnil