Forum Discussion
DAX flag the first occurrence
Hi,
I have below data, I would like to create a calculated column (Rank) to flag only one record with 1 for a supplier that have multiple lines with the same date.
for example, supplier 12345 has 9 records, I want to flag only one record with 1.
Can you please help.
Hi sabd80
You can achieve this by creating an index column, Hope the below pattern fullfuils your requirementP.S. calculated columns can degrade your report performance.
If my answer fulfills your requirement then please mark my post as solution.
Thanks
Tharun
6 Replies
- amitchandak
Super User
sabd80 , You create a measure using new rownumber function
ROWNUMBER(ALLSELECTED(Table[supplier id], Table[Date]),ORDERBY([Date],DESC),LAST,partitionBy(Table[supplier id]) )
Power BI - New DAX Function: Rownumber- https://www.youtube.com/watch?v=yS9-IQjUDwg&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1
- sabd80
Helper IV
this one is not working, it return 1 for all the 9 records.
- Ahmedx
Super User
- Ahmedx
Super User
to do this remove the last two steps
and then you will be able to work with the data and filter it using DAX
- tharunkumarRTK
Super User
Hi sabd80
You can achieve this by creating an index column, Hope the below pattern fullfuils your requirementP.S. calculated columns can degrade your report performance.
If my answer fulfills your requirement then please mark my post as solution.
Thanks
Tharun