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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jsbourni
Helper II
Helper II

value of same semester-to-date last year

Hi,

 

I'm using educational data. Did not quite found a similar example, so here's what I'm struggling to achieve. First, some context. I have 3 tables: calendar, semesters and students. Semesters cannot be included in dates because it generates conflicts. Students complete an admission form prior to the semester, so semesters encompasses 2 date ranges: admission and registration.

The calendar is linked to students' dates, semesters are linked to students' semesters.

My goal is to calculate a semester-to-date and compare it to the same previous semester (automn 2023 to autumn 2022, noted 20233 and 20223 respectively.

I use this to calculate the current or selected semester:

CALCULATE (
    COUNT( 'SSRS - Suivi des décisions'[cdperm] ),
    USERELATIONSHIP(Dates[Date], 'SSRS - Suivi des décisions'[date_dem_adm]),
    FILTER ( ALLSELECTED('SSRS - Suivi des décisions'), 'SSRS - Suivi des décisions'[date_dem_adm] <= MAX ( 'SSRS - Suivi des décisions'[date_dem_adm]) 
I tried fitting something like "selectedvalue(semester[semester]) -10" in a new measure to force the slicer selection to substract 10 (20233 - 10 = 20223). Not working. The second measure should also be a cumulative count.
Any advice?
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jsbourni , If can create year and semester no in your date table and table

Like Summer =1, automn  2

 

The create a key = [Year] &"-"& [semester no]

 

Create a new table Period(if you do not have date table) with distinct [Year],[semester no], [Key]

 

Join both tables on key /date

and new column Date or Period table

Period Rank = RANKX((Period),Period[Key],,ASC,Dense)


This Period = CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])))
Last Period = CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])-1))

 

Last Period same period= CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Year]=max(Period[Year])-1 && Period[Period]=max(Period[Period])))

 

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@jsbourni , If can create year and semester no in your date table and table

Like Summer =1, automn  2

 

The create a key = [Year] &"-"& [semester no]

 

Create a new table Period(if you do not have date table) with distinct [Year],[semester no], [Key]

 

Join both tables on key /date

and new column Date or Period table

Period Rank = RANKX((Period),Period[Key],,ASC,Dense)


This Period = CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])))
Last Period = CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])-1))

 

Last Period same period= CALCULATE(countrows(Table) , FILTER(ALL(Period),Period[Year]=max(Period[Year])-1 && Period[Period]=max(Period[Period])))

 

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

hi,

Thank you for your answer. I have some tweaking to do, but I think it's a good solution.

best,

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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