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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous54000
Frequent Visitor

get last period of PREVIOUS quarter

Hello

I build the bellow calculation to get last period of current quarter:
CALCULATE (
   SUM(_COFI[volume]),
   _COFI[level2] = "Assets",
   ENDOFQUARTER(_COFI[PERIOD])
)

Now I am trying to get : last period of the previous quarter
I am still able to get last period (with "endofquarter") but always from current quarter and not previous quarter. 
Here is one of the example I tried with DATESINPERIOD : 
CALCULATE (
   SUM(_COFI[volume]),
   _COFI[level2] = "Assets",
   ENDOFQUARTER(DATESINPERIOD(_COFI[PERIOD], MAX(_COFI[PERIOD]), -1, QUARTER)
))

All my data are within 1 single table, as bellow:

Anonymous54000_0-1689234905819.png

 

If someone have jus an indea how I should process, it would already help a lot.

Thanks !

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous54000 , with help from date table

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))


Qtr Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER('Date'[Date])))

Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),PREVIOUSQUARTER(('Date'[Date])))

 

 

for last period of qtr use this measure in place sum of sales

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

 

QTD Sales = CALCULATE([MTD Sales],DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE([MTD Sales],DATESQTD(dateadd('Date'[Date],-1,QUARTER)))


Qtr Sales = CALCULATE([MTD Sales],DATESQTD(ENDOFQUARTER('Date'[Date])))

 

Last QUARTER Sales = CALCULATE([MTD Sales],DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
Last QUARTER Sales = CALCULATE([MTD Sales],PREVIOUSQUARTER(('Date'[Date])))

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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