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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jay_patel
Helper IV
Helper IV

Want a calculate column of flag for maximum date for all NDC

Hello all,

I have data of 2 columns NDC & Dates ,and  i want to create another calculated column in same table of Flag (0,1). Please have a look on data

NDCDates 
101-10-2021
102-10-2021
210-10-2021
211-10-2021
215-10-2021
316-02-2022
318-02-2022
321-02-2022

 

After:-

NDCDates flag 
101-10-20210
102-10-20211
210-10-20210
211-10-20210
215-10-20211
316-02-20220
318-02-20220
321-02-20221

 

For every NDC there is maximum date and I want a flag column where there should be 1 for maximum date and 0 for other dates.

Thanks in advance.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@jay_patel , New column

new flag = if( [Date] = maxx(filter(Table, [NDC] = earlier([NDC]) ), [Date]),1,0)

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

View solution in original post

PC2790
Community Champion
Community Champion

Hey @jay_patel ,

 

Use this formula:

Column = var CurrentNDCValue = NDCDataTable[NDC]
var MaxDate = MAXX(FILTER(ALL(NDCDataTable),NDCDataTable[NDC]=CurrentNDCValue),NDCDataTable[Dates ])
return
IF(NDCDataTable[Dates ]=MaxDate,1,0)

Outome:

PC2790_0-1650001166847.png

 

View solution in original post

2 REPLIES 2
PC2790
Community Champion
Community Champion

Hey @jay_patel ,

 

Use this formula:

Column = var CurrentNDCValue = NDCDataTable[NDC]
var MaxDate = MAXX(FILTER(ALL(NDCDataTable),NDCDataTable[NDC]=CurrentNDCValue),NDCDataTable[Dates ])
return
IF(NDCDataTable[Dates ]=MaxDate,1,0)

Outome:

PC2790_0-1650001166847.png

 

amitchandak
Super User
Super User

@jay_patel , New column

new flag = if( [Date] = maxx(filter(Table, [NDC] = earlier([NDC]) ), [Date]),1,0)

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.