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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rachitik67
Frequent Visitor

Custom time period and variation

Hi, i am working in the education field.

 

We have 4 types of time periods :

1- Academic year : Ex: Academic year 2021 is from september 2021 to august 2022

2- Administrative year : Ex : Administrative year 2021 is from may 2021 to april 2022

3- Civil year : 2021 is from january 2021 to december 2021

4 Semesters :

Examples -> Winter 2021 is from january 2021 to april 2021, Summer 2021 is from may 2021 to august 2021 and winter 2021 is from september 2021 to december 2021.

 

I need to get the number of distinct students and the variation each year for each type of periods. the data is extracted every semester. That is why i need the distinct count of the students. Every year, the data for the new year will be added, so the calculation needs to be dynamic.

 

How can i create the custom time periods and how can i calculate the variation each year for the differents time periods?

 

Here is a sample of my data :

DateIDProgram - cd
2020-01-012934321256123
2020-09-012934321256123
2021-05-012934321256123
2020-09-014558209169842
2020-09-013243669169842
2021-05-013243669169842
2021-01-013250377365984
2021-12-013250377245876
2020-05-013114093163988
2021-05-012841033163988
2020-09-015352171396668
2022-01-013114093163988
2022-05-012841033145896
2022-09-015352171396668
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Rachitik67 , You can get different method to create year based on any start date

 

Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...
https://medium.com/chandakamit/cheat-sheet-calendar-of-any-standard-month-just-one-variable-apart-5e...
https://amitchandak.medium.com/cheat-sheet-power-query-financial-year-calendar-5ceaacb520f1
DAX Calendar - Standard Calendar, Non-Standard Calendar, 4-4-4 Calendar
https://www.youtube.com/watch?v=IsfCMzjKTQ0&t=145s
Power BI Date Table: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=18180s

 

new columns 

Year Start Date Sep = Date(if(Month([Date]) <9, Year([Date])-1, Year([Date]) ), 9,1 )

 

Year Start Date May = Date(if(Month([Date]) <5, Year([Date])-1, Year([Date]) ), 5,1 )

 

Semester = Quotient( month([Date]) -1, 4) +1

 

Year Semester  = Year([Date])*100 +  (Quotient( month([Date]) -1, 4) +1 )

 

Semester Rank = Rankx(Date, [Year Semester],,asc,dense)

 

 

Measure to check data this vs last Semester 

 

This Semester = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Semester Rank]=max('Date'[Semester Rank])))
Last Semester = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Semester Rank]=max('Date'[Semester Rank])-1))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Rachitik67 , You can get different method to create year based on any start date

 

Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...
https://medium.com/chandakamit/cheat-sheet-calendar-of-any-standard-month-just-one-variable-apart-5e...
https://amitchandak.medium.com/cheat-sheet-power-query-financial-year-calendar-5ceaacb520f1
DAX Calendar - Standard Calendar, Non-Standard Calendar, 4-4-4 Calendar
https://www.youtube.com/watch?v=IsfCMzjKTQ0&t=145s
Power BI Date Table: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=18180s

 

new columns 

Year Start Date Sep = Date(if(Month([Date]) <9, Year([Date])-1, Year([Date]) ), 9,1 )

 

Year Start Date May = Date(if(Month([Date]) <5, Year([Date])-1, Year([Date]) ), 5,1 )

 

Semester = Quotient( month([Date]) -1, 4) +1

 

Year Semester  = Year([Date])*100 +  (Quotient( month([Date]) -1, 4) +1 )

 

Semester Rank = Rankx(Date, [Year Semester],,asc,dense)

 

 

Measure to check data this vs last Semester 

 

This Semester = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Semester Rank]=max('Date'[Semester Rank])))
Last Semester = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Semester Rank]=max('Date'[Semester Rank])-1))

@amitchandak  Thanks for the reply. I did not get me exactly where i wanted, but it gave me the ideas needed to do what i wanted.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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