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
amaugerb
Frequent Visitor

Time-intelligence functions : dateadd vs previousquarter

Hi all,

 

I'm a new Power BI user and I try to understand how it works.

 

I have a simple report with 2 tables : one calendar (with every days between 2000 and 2025) and one with data.

Here is the very small dataset I used for my tests :

Annotation 2020-06-12 163913.png

 

I then made two new mesures :

value_q1 = CALCULATE(SUM(Data[value]), DATEADD('Calendar'[Date],-1,QUARTER))
value_q2 = CALCULATE(SUM(Data[value]), PREVIOUSQUARTER('Calendar'[Date]))

 

And finally, a small report :

Annotation 2020-06-12 161306.png

 

I now have 2 questions :

  1. why is the Total empty for value_q2?
  2. why is the value_q1 correct for Q2? There is no date D where DATEADD(D, -1, QUARTER) would give january 31st.
DATEADD(2020-04-30, -1, QUARTER) = 2020-01-30
DATEADD(2020-05-01, -1, QUARTER) = 2020-02-01

Therefore, I see no reason why the value_q1 would include the value for january 31st from a pure technical point of vue.

 

The definition of PREVIOUSQUARTER states clearly that the function will build "all dates from the previous quarter, based on the first date" in the current context.

Returns a table that contains a column of all dates from the previous quarter, based on the first date in the dates column, in the current context.

With that in mind, I understand why my result should be correct with that function.

 

However I see DATEADD as a simple shift of dates from current context:

Returns a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context.

And I don't see why the SUM is correct in that case.

If I build a report with the calendar table and a new column :

PreviousQuarter = DATEADD('Calendar'[Date], -1, QUARTER)

I won't have the date 2020-01-31 in that PreviousQuarter column and therefore, I shouldn't have the correct sum.

 

Thank for your help 🙂

1 REPLY 1
v-lili6-msft
Community Support
Community Support

HI  @amaugerb 

You could refer to this post:

https://community.powerbi.com/t5/Desktop/PREVIOUSMONTH/td-p/13307

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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