Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
| NDC | Dates |
| 1 | 01-10-2021 |
| 1 | 02-10-2021 |
| 2 | 10-10-2021 |
| 2 | 11-10-2021 |
| 2 | 15-10-2021 |
| 3 | 16-02-2022 |
| 3 | 18-02-2022 |
| 3 | 21-02-2022 |
After:-
| NDC | Dates | flag |
| 1 | 01-10-2021 | 0 |
| 1 | 02-10-2021 | 1 |
| 2 | 10-10-2021 | 0 |
| 2 | 11-10-2021 | 0 |
| 2 | 15-10-2021 | 1 |
| 3 | 16-02-2022 | 0 |
| 3 | 18-02-2022 | 0 |
| 3 | 21-02-2022 | 1 |
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.
Solved! Go to Solution.
@jay_patel , New column
new flag = if( [Date] = maxx(filter(Table, [NDC] = earlier([NDC]) ), [Date]),1,0)
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:
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:
@jay_patel , New column
new flag = if( [Date] = maxx(filter(Table, [NDC] = earlier([NDC]) ), [Date]),1,0)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!