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
sabd80
Helper IV
Helper IV

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.


2024-02-06_14-18-21.png

1 ACCEPTED SOLUTION
tharunkumarRTK
Super User
Super User

Hi @sabd80 

You can achieve this by creating an index column, Hope the below pattern fullfuils your requirement

Screenshot 2024-02-06 at 10.49.08 AM.png

P.S. calculated columns can degrade your report performance. 

 

If my answer fulfills your requirement then please mark my post as solution.

 

Thanks

Tharun

View solution in original post

6 REPLIES 6
tharunkumarRTK
Super User
Super User

Hi @sabd80 

You can achieve this by creating an index column, Hope the below pattern fullfuils your requirement

Screenshot 2024-02-06 at 10.49.08 AM.png

P.S. calculated columns can degrade your report performance. 

 

If my answer fulfills your requirement then please mark my post as solution.

 

Thanks

Tharun

Ahmedx
Super User
Super User

if the supplier has the same dates, then only in power query you can do this

Screenshot_1.png

@Ahmedx , Thanks for your solution.
I need the other records, so I can't remove them, plus I have a huge data all these transformation will affect the performance of the report.

to do this remove the last two steps
and then you will be able to work with the data and filter it using DAX

Screenshot_1.png

amitchandak
Super User
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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

this one is not working, it return 1 for all the 9 records.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.