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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JoSwinnen
Helper I
Helper I

If there is no next row for an ID, the previous row needs to be counted

Hi all, 

 

a DAX question. So I have multiple rows per ID for each year. Each row represents a registration of a student. And if the student is not graduated yet there appears no in the row. If he graduates, like for instance 000001 after 3 years, there will appear yes. Now I want to know how many students did not graduated in a year AND did not register the next year. In the example, student 000002 did not graduated in 2020 and he didn't register in 2021. This student needs to be counted in 2020. Student 000003 needs to be counted in 2019. 

 

StudentID     Date    Graduated? 

000001           2019       No

000001           2020       No

000001           2021       Yes

000002           2019         No

000002           2020        No

000003           2019        No

000004           2019        No

000004          2020        Yes

 

Any ideas?

 

Thanks,

 

Jo 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood the question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1662992892277.png

 

 

 

Jihwan_Kim_0-1662992878605.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood the question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1662992892277.png

 

 

 

Jihwan_Kim_0-1662992878605.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
tamerj1
Super User
Super User

Hi @JoSwinnen 

is the Date column actually a date data type of just contains the year number (integer)?

It just contains the year number.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.