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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
POSPOS
Post Patron
Post Patron

Index for each group using DAX

Hi All,

I have a requiremet to get the idexes for each group of data.

Please find sample data below:


Note: We have other columns too in the actual data. this is only a sample data

ProtocolStatusDate
AApproved1/2/2022
BOpen5/6/2022
BIn Progress5/7/2022
BClosed5/8/2022
CIn Progress5/7/2022
CClosed5/8/2022
DExempt5/9/2023

 

Expected Output:

ProtocolStatusDateIndex
AApproved1/2/20221
BOpen5/6/20221
BIn Progress5/7/20222
BClosed5/8/20223
CIn Progress5/7/20221
CClosed5/8/20222
DExempt5/9/20231

 

Could somone pls let me know how to achieve this using DAX.

 

Thank you

 

2 REPLIES 2
vicky_
Super User
Super User

If the Index is based on date, then you're basically looking for the count of items less than or equal to the current date for each Protocol. 

 

This is the DAX I used: 

Index = COUNTROWS(FILTER(ALL('Table'), 'Table'[Date] <= SELECTEDVALUE('Table'[Date]) && 'Table'[Protocol] = SELECTEDVALUE('Table'[Protocol]))) 

vicky__1-1695940637279.png

 

 

@vicky_  I am trying to assign a row number for every statuses of a protocol. Can we have the DAX without using the date?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.