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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Johnsie
Frequent Visitor

Cumulative count of rows not based on other columns (with DAX)

Hello,

 

I want to create a calculated column which calculates the cumulative count of rows in this column. It shall not be based on other columns like for example "Year". Something like in the picture below, similar to an index column.

Johnsie_0-1697015393031.png

 

Thanks for your help.

1 ACCEPTED SOLUTION

Hi @Johnsie,

 

Has I refered you need context and currently there is no option to get only a countrows without telling the columns you want to refer to.

 

Going back to the question when you say that you don't want the column to be filtered when you apply a filter in the visual what do you mean? You always want it to be there with values from 1 to N correct?

 

Using the ALLSELECTED will give you that continues number now matter what are the filters you apply.

 

Example

2021 - 1 

2022 - 2

2023 - 3

 

Whith Filter

2022 - 1

2023 - 2

 

Is that what you need?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
Johnsie
Frequent Visitor

Hey @MFelix 

 

Yes I think so. Thanks for your help.

MFelix
Super User
Super User

Hi @Johnsie ,

 

Dax calculations are based on context so if you do not add anhy other columns to your calculation then the result will not be achieved how you need, when you refer that you don't want to have it based on another column is it because the column may vary or because you can be applying filters to your calculation?

 

Check if this post may help, I know it's based on another column but as I refered DAX is context based.

https://community.fabric.microsoft.com/t5/Desktop/How-to-add-a-Serial-Row-Number-Column-in-Power-BI-...

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hey @MFelix 

thanks for your answer.

It is because I dont want this column to be filtered if I apply a filter in a visual.

Is there a possibility to count the rows with COUNTROWS() based solely on how many rows there are in the table?

Hi @Johnsie,

 

Has I refered you need context and currently there is no option to get only a countrows without telling the columns you want to refer to.

 

Going back to the question when you say that you don't want the column to be filtered when you apply a filter in the visual what do you mean? You always want it to be there with values from 1 to N correct?

 

Using the ALLSELECTED will give you that continues number now matter what are the filters you apply.

 

Example

2021 - 1 

2022 - 2

2023 - 3

 

Whith Filter

2022 - 1

2023 - 2

 

Is that what you need?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.