Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
dfour
Regular Visitor

Dynamic row numbering for drill through table

Hello, 

So i have a database and i've applied certain filters on it to get drill through table visuals.

i need index number for each row in the table, i was trying all day but without any success

the row counts can be from 0 to 6K cols

 

This is the best i can get 

image.png

 

Current measure : 
image.png

btw when i apply the same measure to another table (having 1000+ cols) this is the result : 

image.png

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @dfour ,

 

You may try this measure.

RowNum = 
CALCULATE (
    COUNT ( 'Table'[Emp Number] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Emp Number] <= MAX ( 'Table'[Emp Number] )
    )
)

result1.gif

 

You can check more details from here.


Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @dfour ,

 

You may try this measure.

RowNum = 
CALCULATE (
    COUNT ( 'Table'[Emp Number] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Emp Number] <= MAX ( 'Table'[Emp Number] )
    )
)

result1.gif

 

You can check more details from here.


Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@amitchandak That will not work, because the table is just visual table with cols from different tables and results can be changed with filters

AllisonKennedy
Super User
Super User

Looks like it might be a matter of counting the right table[column] combination. What does your data model look like? You could also just use COUNTROWS function and then don't need calculate.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy 

i tried countrows before with no success

 

image.png

The table takes filters from drill through and shows a visual table for employees with the filters applied

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.