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
Syndicate_Admin
Administrator
Administrator

Crear un Index (index) en dax power BI

Hello good day, I would like to create a calculated field, that gives me the number of columns, and works as index, since I know that you could in power query, but I occupy that it is in specific in dax or power bi, I do not know if I explain, but basically it is an index, that at the time of adding a new row I count consecutively, and when you delete the row it is deleted consecutively, that is, as a count rows, which is the process automatically

marioomontoya_0-1668996978761.png

Thank you.

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

It is doable via DAX, but, please do it in Power Query or Excel. 

 

In PQ, you just need an index column, 

In Excel, you just need to write =ROW(), 

That's it. 

 

In DAX, you need this,

FreemanZ_0-1668998834633.png

INDEX3 =
VAR _Index= 'Table'[Index]
RETURN
    COUNTROWS(
        FILTER(
            'Table',
            'Table'[Index]<_Index
        )
)+1
 
there are other ways with RANKX, like this:
INDEX2 =
RANKX(
    ALL('Table'[Index]),
    'Table'[Index],
    ,
    ASC
)
but all share a major flaw: you need comparable values in a columnm, which is not always readily there. 

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

It is doable via DAX, but, please do it in Power Query or Excel. 

 

In PQ, you just need an index column, 

In Excel, you just need to write =ROW(), 

That's it. 

 

In DAX, you need this,

FreemanZ_0-1668998834633.png

INDEX3 =
VAR _Index= 'Table'[Index]
RETURN
    COUNTROWS(
        FILTER(
            'Table',
            'Table'[Index]<_Index
        )
)+1
 
there are other ways with RANKX, like this:
INDEX2 =
RANKX(
    ALL('Table'[Index]),
    'Table'[Index],
    ,
    ASC
)
but all share a major flaw: you need comparable values in a columnm, which is not always readily there. 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.