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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.