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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
asuprunova
Frequent Visitor

Help to calculate values to previous period.

Hello, I hope someone will be able to help me with the problem I have. I have a table that specifies student hours by term. For example, I want to know what is the difference in hours between Fall 2020 and Fall 2021. I tried inserting "fake" dates, connected them to the Date dimension table, and implemented the DATEADD function. But it would not give me the result I am looking for. I am suspecting this is because this is not a year-to-year comparison. But I still don't understand why this would not work.  

This is my expression, and I had tables where it work just fine, but not for this one. 

_CH =
VAR _CH =
CALCULATE(CreditHours[_CreditHoursSum], DATEADD(CreditHours[Date],-1,YEAR))
RETURN
_CH
I only have fall semester there, but I do have all semesters in the table I need values for. 
 
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
NilR
Post Patron
Post Patron

VAR _CH =
CALCULATE(SUM(CreditHours[_CreditHoursSum])DATEADD(CreditHours[Date],-1,YEAR))
OR
CALCULATE(SUM(CreditHours[_CreditHoursSum]), PREVIOUSYEAR(CreditHours[Date]))
OR
CALCULATE(SUM(CreditHours[_CreditHoursSum]), SAMEPERIODLASTYEAR(CreditHours[Date]))

Yep, I tried what you offered and it does not return results. Also, in my expression the variable_CreditHoursSum was already a summarization, that is why I skipped SUM in my expression. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors