Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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).
User | Count |
---|---|
77 | |
75 | |
46 | |
31 | |
28 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
46 |