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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mihaita_baro
Helper II
Helper II

New column based on comparing previous records

Hi guys,

 

I am working on a dashboard where i have to report which training course was not renewed. 

 

My data set looks like below and i want to add a new column called:

- Renewed and another one called,but I have no ideea how to compare curent row records with next record

- Renewal In 2 months for those that are due to expire in 2 months from current date, 

 

 

CourseIdTRAINING::CourseUSERS::FullNameTrainingDateTrainingRenewByDateOutOfDateRenewed
1Manual HandlingJohn Stone29/04/202130/04/20221 
1Manual HandlingJohn Stone22/04/202223/04/2023 1
2Lone WorkerJohn Stone23/04/202124/04/20221 
2Lone WorkerJohn Stone21/04/202222/04/2023 1
3Complaint training & conflicts resolutionJohn Stone29/04/202130/04/20221 
3Complaint training & conflicts resolutionJohn Stone21/04/202222/04/2023 1
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @mihaita_baro 

" to compare curent row records with next record", you can use filter to get the record with earlier date and then the one with another date from the same CourseId, for example,

m1 = 
var _date=CALCULATE(MIN('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId]))
return IF(MIN('Table'[TrainingDate])= _date,1)
m2 = 
var _date=CALCULATE(MAX('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId]))
return IF(MIN('Table'[TrainingDate])= _date,1)

vxiaotang_0-1653290326001.png

to find renewal In 2 months for those that are due to expire in 2 months from current date, you can use edate() to get the date 2 months from today, then use it to compare the renew date.

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-xiaotang
Community Support
Community Support

Hi @mihaita_baro 

" to compare curent row records with next record", you can use filter to get the record with earlier date and then the one with another date from the same CourseId, for example,

m1 = 
var _date=CALCULATE(MIN('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId]))
return IF(MIN('Table'[TrainingDate])= _date,1)
m2 = 
var _date=CALCULATE(MAX('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId]))
return IF(MIN('Table'[TrainingDate])= _date,1)

vxiaotang_0-1653290326001.png

to find renewal In 2 months for those that are due to expire in 2 months from current date, you can use edate() to get the date 2 months from today, then use it to compare the renew date.

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

hi @v-xiaotang this is not working because it needs to compare if the course id and the name are the same.

 

How do i compare both fields in Dax. ?

Hi @mihaita_baro 

Thanks for your reply.

>>because it needs to compare if the course id and the name are the same.How do i compare both fields in Dax. ?

You need to compare course id and users fullname? But these two columns are not the same in the sample data. Could you please give an example based on the sample data? Thanks

vxiaotang_0-1653555738863.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xiaotang  

 

Maybe i didint explained my self very good. The data looks like in the above just that for one CourseID i have multiple Users not just one.

 

So i need the latest record for an user and a course to be called as Renewed. 

 

I am working on this for couple of weeks and still cant get my head arround this

Hi @mihaita_baro 

Thanks for reply.

In this scenario, put "'Table'[USERS::FullName]" into allexcept(),

vxiaotang_0-1653617619655.png

measures:

m1 =
var _date=CALCULATE(MIN('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId],'Table'[USERS::FullName]))
return IF(MIN('Table'[TrainingDate])= _date,1)

 

 

m2 =
var _date=CALCULATE(MAX('Table'[TrainingDate]),ALLEXCEPT('Table','Table'[CourseId],'Table'[USERS::FullName]))
return IF(MIN('Table'[TrainingDate])= _date,1)

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Hi

 

I am still getting the same result, it's 1 for the olderst training date no matter the courseID or Name.

 

this is my measure, 

 

Renewed =
var _date=CALCULATE(MAX('TrainingRecord'[TrainingDate]),ALLEXCEPT(TrainingRecord,'TrainingRecord'[CourseId],TrainingRecord[Training»Course_Attendees»USERS::FullName]))
return IF(MIN('TrainingRecord'[TrainingDate])= _date,1)
 
 

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors