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
cwfmoore
Regular Visitor

Change academic year text from 2021-22 to 2020-21 in a DAX measure?

Designing a dashboard for a college. Their academic years span two calendar years.

Eg:

  • 2021-22
  • 2020-21
  • 2019-20

I would like to create a set of measures where I only have to update the measure for the most recent year.  For example:

  • Last year = "2021-22"

Then have a measure that reads that string in [Last Year] and creates academic year -1 automatically. For example:

  • Last year (minus 1) = "[Last Year 20(21 - 1) - (22 - 1)]"
  • Resulting in Last year (minus 1) = "2020-21"

Essentially preventing the need to up date all the measures for each year.  I hope this makes sense.

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @cwfmoore 

 

Try this measure:

Last year (minus 1) = 
Var _Year1 = left([Last Year],4)-1
Var _Year2 = Right([Last Year],2)-1
return
_Year1&"-"&_Year2

 

VahidDM_0-1666008815380.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @cwfmoore 

 

Try this measure:

Last year (minus 1) = 
Var _Year1 = left([Last Year],4)-1
Var _Year2 = Right([Last Year],2)-1
return
_Year1&"-"&_Year2

 

VahidDM_0-1666008815380.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Perfect, thank you!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors