Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rod_puente
Helper I
Helper I

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:

rod_puente_0-1725325339537.png

 

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

 

1 ACCEPTED SOLUTION
suparnababu8
Super User
Super User

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])))

View solution in original post

3 REPLIES 3
suparnababu8
Super User
Super User

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])))

Ashish_Mathur
Super User
Super User

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?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

you can try this to create an index

 

Column = CALCULATE(DISTINCTCOUNT('Table'[client]),FILTER('Table','Table'[client]<=EARLIER('Table'[client])))
 
11.PNG
 
or create a measure
Measure = CALCULATE(DISTINCTCOUNT('Table'[client]),FILTER(ALL('Table'),'Table'[client]<=MAX('Table'[client])))
 
12.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.