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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
moeconsult
Helper V
Helper V

Accademic Year

Please I need help with this question below:

 

I have a table with StartDate and Enddate columns. I would like to create a Academic year column for my report usisng the start and end date columns  as my report is an academic year for reporting . My requirement is to show all values by defualt and initial report needs to be filtered  by 1st September 2020 to 31st August 2021 (the year we are in) 

 

Thanks for your help .

 

Regards,

Ola

1 ACCEPTED SOLUTION
Adescrit
Impactful Individual
Impactful Individual

I would start off by creating a calendar table.

In the Modelling tab at the top of Power BI desktop, click on "New Table", and then enter the following code:

 

Calendar =
ADDCOLUMNS (
    CALENDAR (
        MIN ( 'Academic Years'[Start Date] ),
        MAX ( 'Academic Years'[Start Date] )
    ),
    "DateAsInteger", FORMAT ( [Date], "DDMMYYYY" ),
    "Year", YEAR ( [Date] )
)

 

Note I'm assuming here that your start date and end date columns are in a separate table called 'Academic Years'.

 

This will create a new table in which the first column is a list of dates between the start of the first academic year and the end of the final academic year in your initial 'Academic Years' table.

 

Now you can create a new column in your Calendar table that identifies which academic year each date falls into.

 

Academic Year = 
IF (
    MONTH('Calendar'[Date]) <= 9,
    "AY"
        & RIGHT( VALUE('Calendar'[Year]),2)-1 & "/" & RIGHT( VALUE('Calendar'[Year]),2),
    "AY"
        & RIGHT( VALUE('Calendar'[Year]),2) & "/" & RIGHT( VALUE('Calendar'[Year]),2) + 1
)

 

You can then use this column as a filter to select which academic year you would like to view. (Ensure the 'Calendar' table is connected to the data you are filtering first.


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

View solution in original post

2 REPLIES 2
Adescrit
Impactful Individual
Impactful Individual

I would start off by creating a calendar table.

In the Modelling tab at the top of Power BI desktop, click on "New Table", and then enter the following code:

 

Calendar =
ADDCOLUMNS (
    CALENDAR (
        MIN ( 'Academic Years'[Start Date] ),
        MAX ( 'Academic Years'[Start Date] )
    ),
    "DateAsInteger", FORMAT ( [Date], "DDMMYYYY" ),
    "Year", YEAR ( [Date] )
)

 

Note I'm assuming here that your start date and end date columns are in a separate table called 'Academic Years'.

 

This will create a new table in which the first column is a list of dates between the start of the first academic year and the end of the final academic year in your initial 'Academic Years' table.

 

Now you can create a new column in your Calendar table that identifies which academic year each date falls into.

 

Academic Year = 
IF (
    MONTH('Calendar'[Date]) <= 9,
    "AY"
        & RIGHT( VALUE('Calendar'[Year]),2)-1 & "/" & RIGHT( VALUE('Calendar'[Year]),2),
    "AY"
        & RIGHT( VALUE('Calendar'[Year]),2) & "/" & RIGHT( VALUE('Calendar'[Year]),2) + 1
)

 

You can then use this column as a filter to select which academic year you would like to view. (Ensure the 'Calendar' table is connected to the data you are filtering first.


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

Thanks for your help, But am not sure if this possible, I want my report to be filtered by Academic Year (Periods) and also an exact date for example, if I want my report to display student that attended a session between 01/01/2020 and 31/01/2020. 

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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