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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
PBInterest
Frequent Visitor

DAX Previous Quarter with date table that can span over years

In my data model I have two tables, one is named "Sales" and the other is my "Dates" table. The Dates table is flagged as a date type table. In my Sales table I have a SoldOn date and the data type is date. I join the SoldOn date to the Date in the date table in my model. Now I want to calculate the previous quarter data and be able to move across years. I already have a measure in the model named GrossSales, this is what I want to see previous quarter totals on.

 

First I try this:

 

PVQTR:=CALCULATE([GrossSales], PARALLELPERIOD('Sales'[SoldOn], -1, quarter))

And this works using the date from the Sales table, but in my report I want to use the Date table to filter this data. So in my date table I have a value for Year Quarter. I want to use that in a slicer so the user can select the starting quarter. Even though those tables have a relationship, the measure above does not display the correct previous quarter when slicing on a value from the Date table. If I change the measure to use the date value from the Date table it doesn't work at all.

 

PVQTR:=CALCULATE([GrossSales], PARALLELPERIOD('Dates'[Date], -1, quarter))

 

I feel like I am missing something simple here. Any feedback is appreciated.

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PBInterest ,

This one

PVQTR:=CALCULATE([GrossSales], PARALLELPERIOD('Dates'[Date], -1, quarter))

 

or

PVQTR:=CALCULATE([GrossSales], dateadd('Dates'[Date], -1, quarter))

 

should work.

Make sure

1. Dates is marked as date table

2. You are using qtr, month, year, any date related columns from date table only

 

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

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

@PBInterest ,

This one

PVQTR:=CALCULATE([GrossSales], PARALLELPERIOD('Dates'[Date], -1, quarter))

 

or

PVQTR:=CALCULATE([GrossSales], dateadd('Dates'[Date], -1, quarter))

 

should work.

Make sure

1. Dates is marked as date table

2. You are using qtr, month, year, any date related columns from date table only

 

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

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

Yep, knew I was overlooking something simple. Had the wrong slicer setup when I was testing between the two different measures. Thanks for your help, much appreciated.

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.