Forum Discussion

rod_puente's avatar
rod_puente
Helper I
1 year ago
Solved

Help with Index for DAX

¡Hi Everyone!

 

Pls, I need to know how I can add an index by DAX, so that I can have a cumulative sum like the following image:

 

I need the index for DAX, I don't need it for Power Query.

Is there a solution for an accumulated balance?

 

Regards

Rodrigo Puente

 

  • To add an index column using DAX in Power BI, you can use several different functions depending on your specific needs. Here are a few common methods:

    Using the ROW Function

    Using the RANKX Function - Index = RANKX(ALL(Table), Table[Column], , ASC, DENSE)

     

    Pls go through this - https://learn.microsoft.com/en-us/dax/index-function-dax

     

    Using the COUNTROWS and FILTER Functions - Index = COUNTROWS(FILTER(Table, Table[Column] <= EARLIER(Table[Column])))

3 Replies

  • you can try this to create an index

     

    Column = CALCULATE(DISTINCTCOUNT('Table'[client]),FILTER('Table','Table'[client]<=EARLIER('Table'[client])))
     
     
    or create a measure
    Measure = CALCULATE(DISTINCTCOUNT('Table'[client]),FILTER(ALL('Table'),'Table'[client]<=MAX('Table'[client])))
     
     
  • Hi,

    If you have a Date column in your Fact table, then the problem is easy to solve.  If not, then in what order should the data be arranged to calculate the cumulative total?  Should it be in ascending order of Cleints?

  • To add an index column using DAX in Power BI, you can use several different functions depending on your specific needs. Here are a few common methods:

    Using the ROW Function

    Using the RANKX Function - Index = RANKX(ALL(Table), Table[Column], , ASC, DENSE)

     

    Pls go through this - https://learn.microsoft.com/en-us/dax/index-function-dax

     

    Using the COUNTROWS and FILTER Functions - Index = COUNTROWS(FILTER(Table, Table[Column] <= EARLIER(Table[Column])))