Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi, How can I add row number in the Calculated table?
RANKX gives me the same number if the totals are the same.
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
)
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.
@gtamir ,
What is your excepted result?
@v-frfei-msft A series of numbers from 1 to the end. If I refer to TOTAL, If some values are the same, I want the index to go forward and not to rank them the same.
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
@az38 thanks for the quick answer. What should be Table1? It does not allow me to enter the current table.
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
The first suggestion is a measure so I can use it in a visual.
Here is the formula and the table.
I see Index field. couldn't it be used as row number?
try to add a measure into you table
IndexColumn = CALCULATE(
COUNT('RunningTotalByMetupalim'[Total]);
FILTER(ALLSELECTED('RunningTotalByMetupalim');'RunningTotalByMetupalim'[Total]<= MAX('RunningTotalByMetupalim'[Total]))
)
do not hesitate to give a kudo to useful posts and mark solutions as solution
The index is RANKX. It gives the same rank if the total is the same. Then the accumulative total is wrong.
What do you mean measure? I need to add a column.
well @gtamir measure it's a like column but more complex 🙂
anyway you can try to use column with the same formula as above, but im not sure it will work
do not hesitate to give a kudo to useful posts and mark solutions as solution
No, I tried that.
Still says unexpected expression,
I changed the other comma but it gives me the same number all over.
OK, What to do with it?
share your pbix-file, please, for example at https://uploadfiles.io/
do not hesitate to give a kudo to useful posts and mark solutions as solution
OK I'll cut it and send it later. Thanks
https://drive.google.com/file/d/1tmi9FjsBuooX5Gl1gkPR0GT6ZxZZhaBV/view?usp=sharing
You can see that row 10 and 11 have the same rank (10).
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
38 | |
31 |
User | Count |
---|---|
78 | |
64 | |
64 | |
49 | |
45 |