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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
uc
Helper II
Helper II

To find out school year

Hello

In UK, children start school in September after their 4th birthday. In a given cohort I need to filter only reception age group. For e.g. children starting in Sep 2021, will have their DOB between 01/09/ 2016 to 31/08/2017

 

I am able to filter the cohort using excel as shown in the attached snapshot. I am interested in only Year 0 (Reception) cohort. However, when I tried to upload the data and tried to calcualte the school year in Power BI I get different result which isn't correct. Attached Power BI snapshot too. Can you please advise where I could have got it wrong?  Thanks in advance.

 

Excel snapshot.PNGPower BI snapshot.PNG

 

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is a modified DAX that should work:

Year = IF(ISBLANK([DOB]),BLANK(),"Year "&
IF(MONTH(DOB[DOB])<9,DATEDIFF(DOB[DOB],TODAY(),YEAR)-4,
DATEDIFF(DOB[DOB],TODAY(),YEAR)-5))
End result:
ValtteriN_0-1641687848096.png

So in this example the only child starting this year would be the one born in 1.1.2018. This checks out since during this year's September they have turned four.

Regarding your original formula. It is not usually a good idea to use days in formulas (like with 122) so I used different method in my example. 

I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up!

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

Here is a modified DAX that should work:

Year = IF(ISBLANK([DOB]),BLANK(),"Year "&
IF(MONTH(DOB[DOB])<9,DATEDIFF(DOB[DOB],TODAY(),YEAR)-4,
DATEDIFF(DOB[DOB],TODAY(),YEAR)-5))
End result:
ValtteriN_0-1641687848096.png

So in this example the only child starting this year would be the one born in 1.1.2018. This checks out since during this year's September they have turned four.

Regarding your original formula. It is not usually a good idea to use days in formulas (like with 122) so I used different method in my example. 

I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up!

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thankyou. It works.

Hi,

Could you mark my post as a solution? That helps other to find the answer easier in the future.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.