Forum Discussion

gtamir's avatar
gtamir
Icon for Post Patron rankPost Patron
6 years ago

Row number in calculated table

Hi, How can I add row number in the Calculated table?

RANKX gives me the same number if the totals are the same.

21 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    hi gtamir 

    try

    IndexColumn = CALCULATE(
    COUNT('Table1'[Column1]);
    FILTER(ALLSELECTED('Table1');'Table1'[Column1]<= MAX('Table1'[Column1]))
    )

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    LinkedIn

    • gtamir's avatar
      gtamir
      Icon for Post Patron rankPost Patron

      az38  thanks for the quick answer. What should be Table1? It does not allow me to enter the current table.

      • az38's avatar
        az38
        Icon for Community Champion rankCommunity Champion

        gtamir 

        Why?

        after creating your calculated table to data model it appears in the right Fields Pane. the you can create a new measure in this table. So, Table1 is your calculated table, Column1 is a field that will determine index order

        alternatively, you can use ADDCOLUMNS function over your statement that defines your calculated table. we will try to help you, if you share your table formula here

        do not hesitate to give a kudo to useful posts and mark solutions as solution

         

         

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi gtamir ,

     

    Here we go.

    running total = 
    CALCULATE (
        SUM ( RunningTotalByMetupalim[TOTAL] ),
        FILTER (
            RunningTotalByMetupalim,
            RunningTotalByMetupalim[Metupal Name]
                <= EARLIER ( RunningTotalByMetupalim[Metupal Name] )
        )
    )
    
    index_ = 
    RANKX (
        RunningTotalByMetupalim,
        RunningTotalByMetupalim[running total],
        ,
        ASC,
        DENSE
    )
    

     

    • gtamir's avatar
      gtamir
      Icon for Post Patron rankPost Patron

      Thanks v-frfei-msft  but I don't understand the RunningTotal.

      In my formula, I sort TOTAL first, and then Cumulative Total aggregates the totals. In your Running total it is not.

      You sort the table by the name.