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.
I have created metrics table using three column description and sales values
now i need to give serial number using dax formula, pls suggest
column name like product, manager, sales amount
1
2
3
thanks
Hi @RajK2
Thanks for the update and sharing the visuals. I can see what's going wrong here, the current DAX approach with RANKX over a pre-summarized table (SUMMARIZECOLUMNS) creates a static table that ignores your filters, even though it might look like it's working. That’s why you’re getting repeating index numbers or unexpected results when applying slicers, it doesn’t dynamically adjust to what's visible in the visual.
Try bellow dax to achieve filter-respecting.
Index Measure = RANKX(ALLSELECTED(Metrics), CALCULATE(SUM(Metrics[Sales Amount])), ASC, DENSE)
If you just want row numbers, you can simplify it to
Index Measure = RANKX(ALLSELECTED(Metrics),Metrics[Product],,ASC,DENSE)
This respects the filters from slicers, page-level filters, etc, and it gives you a clean 1, 2, 3, ... index with no need for RAND() or static summaries, it’s dynamic and works in visuals directly.
In case if still your index doesn’t need to change with filters, Power Query's “Add Index Column” is still the cleanest.
_________________________________________________________________________________________________________________________
If this response helps, consider marking it as “Accept as solution” and giving a “kudos” to assist other community members.
Thank you,
Akhil.
hI @RajK2
Assuming there are multiple tables involve, try something like below
Index Measure =
VAR vTable =
SUMMARIZECOLUMNS (
'Category'[Category],
'Category'[sort],
'Geo'[Geo],
REMOVEFILTERS(), -- Fully unfilter report context
"Total_Revenue", [Total Revenue]
)
VAR Index =
RANKX (
vTable,
[Total Revenue] + ( RAND() * RAND() ),
,
ASC,
DENSE
)
RETURN
Index
RAND() is not necessary but may help with breaking ties
I am not getting same answer so its repiting each rows with same appears
I want simple I applied multiple filters as i need rows sequence 1,2,3,4,5 without any issues
Thanks!
Hi @RajK2 ,
For creating a serial number, I recommend to use Power Query as the best practice, because there is often no inherent business order in a table.
Using Power Query's "Add Index Column" is the superior method because it creates a simple, static index based on the row's position during data import, without needing any sorting logic.
The DAX RANKX function, in contrast, is designed for value-based ranking (e.g., ranking sales from highest to lowest). Using it for a simple serial number is inefficient and forces a sorting logic that may not be meaningful.
Recommended Steps:
This approach is simpler, more performant, and better suited for this exact task.
Best regards,
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 |
---|---|
78 | |
75 | |
58 | |
36 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |