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
Anonymous
Not applicable

Measure for counting depending on the date slicer and status

Hello! Say I have a list of students passing some exams (аn analogue of my product management task). Each row includes the name of student, subject, date of submission, check date and grade. For simplification purposes let's consider only one week. Let's consider the following table (in it's latest/actual version):
img_01.png
And I need to create a measure to count how many students there are depending on grade and date. Exams with check date greater than slicer date are considered to be unverified (when the check date is out of slicer upper bound).
img_02.pngimg_03.png
I've tried a lot of approaches playing around with different filterings (KEEPFILTERS, ALLSELECTED, etc) and nothing good happend. Also I created a measure from the calendar to help out:

date_upper = CALCULATE(MAX(dates[date]), ALLSELECTED(dates))

Any help is appreciated! Thanks is advance.
1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

@Anonymous 

 

Here's a full solution. Study it carefully because it's not very easy. Requires a rather good command of DAX (and logic) to understand.

View solution in original post

9 REPLIES 9
daxer-almighty
Solution Sage
Solution Sage

@Anonymous 

 

Please mark my answer as the solution so that others can find it easier and to boost my status on the forum. Thank you.

daxer-almighty
Solution Sage
Solution Sage

@Anonymous 

 

Here's a full solution. Study it carefully because it's not very easy. Requires a rather good command of DAX (and logic) to understand.

Anonymous
Not applicable

Huge thanks for quick response! Btw, I've spotted an issue, that some values fall out of total sum in the row context.
img_01.png

 

"And I need to create a measure to count how many students there are depending on grade and date."

 

You're wrong in your answer. You're calculating the number of students in the current context. My formula is absolutely correct.

Anonymous
Not applicable

I really appreciate your help. Thank you a lot. I've fixed this a little bit to satisfy the original requirement (count exams, not students), but I still have the issue with a total sum along rows. I can't come up with the way around.

Anonymous
Not applicable

Oh, my bad. I meant the number of exams. That's what the illustrations about - to count how many exams particular student took with partition by subject and grades according to the date slicer. My sample with only unit values is pretty misleading

@daxer-almighty 

Was your reply for me?

I think you were mistaken, I am not the one who opened this thread 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

You thought correctly.

aj1973
Community Champion
Community Champion

Hi @Anonymous 

Can you provide a Sample of your file

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

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