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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (2,039)