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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ZakJ
New Member

Filtering and counting results based on variable date

Hi everyone,

 

I'm currently looking to create a measure of how many courses users went on to complete on average after completing a specific course (e.g course 2 in the sample data below). 

 

I've gotten stuck with it as the training date for the course varies by user for "course 2" and some users also haven't completed "course 2". 

 

I'm not particularly sure how to describe the question so appologies in advance if it has been asked before!

 

Table name: TrainingData

ID NumberCourseTraining Date
1Course 110/11/2021
1Course 201/01/2022
1Course 305/01/2022
1Course 406/01/2022
1Course 506/01/2022
1Course 606/01/2022
2Course 103/02/2022
2Course 201/02/2022
2Course 301/01/2022
2Course 405/01/2022
2Course 506/01/2022
2Course 603/03/2022
3Course 305/02/2022
3Course 406/02/2022
3Course 507/02/2022
4Course 503/02/2022
4Course 404/02/2022
4Course 505/01/2021
5Course 203/03/2022
5Course 301/01/2021
5Course 404/03/2022
5Course 605/03/2022

 

 

Thanks in advance for any help!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ZakJ , Create a measure like


Measure =
var _course = "Course 2" //selectedvalues(Course[Course]) //use independent course table in slicer
var _date = maxx(filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Course] =_course ), [Date])
return
calculate(countx(values(Table[User]), calculate(count(Table[Course]), filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Date] > _date))))

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

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi,  @ZakJ 

Could you please tell me whether your problem has been solved?

If yes, you could accept the helpful answer as solution. 

If you still need help, please share a sample file and expected result here for further research.

Best Regards,
Community Support Team _ Eason

 

amitchandak
Super User
Super User

@ZakJ , Create a measure like


Measure =
var _course = "Course 2" //selectedvalues(Course[Course]) //use independent course table in slicer
var _date = maxx(filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Course] =_course ), [Date])
return
calculate(countx(values(Table[User]), calculate(count(Table[Course]), filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Date] > _date))))

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
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.

Top Kudoed Authors