The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
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,
This measure works
S. No. = ROWNUMBER(ALLSELECTED(Data),ORDERBY(Data[Date Presented]))
Hope this helps.
Hi @RajK2 ,
Since we haven’t heard back from you, we’ll proceed to close this thread for now. If you continue to experience issues or have any additional questions, feel free to start a new thread in the Microsoft Fabric Community Forum. We’re always here to help and happy to support you.
Regards,
Akhil.
Hi @RajK2 ,
Just looping back once more we haven’t heard from you on this thread. If the updated RANKX measure helped solve the issue with dynamic indexing and filter responsiveness, that’s great to hear! Otherwise, feel free to drop a quick update if you're still facing any roadblocks happy to assist further.
Best regards,
Akhil
Hi @RajK2 ,
I’m following up to confirm that all items discussed have been addressed. If there’s anything else you need, I’d be happy to assist.
Regards,
Akhil
Hi @RajK2 ,
Just checking in did the updated RANKX approach work better with your filters and visuals? It should give you that dynamic index you're looking for, but if it's still behaving unexpectedly or needs tweaking for a specific scenario, feel free to share a bit more context. Happy to help get it just right.
Regards,
Akhil.
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,