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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rahulrackup
Employee
Employee

Calculating current & prior year quarter measure dynamically with separate slicer for month and year

Hi Everyone,

I'm very new to Power BI, appreciate it if you could help me find the solution. My scenario is I need to calculate the total sum of a measure for the current and previous year quarter, please see below snip but the problem is there are two separate slicers one for FISCAL MONTH and other for YEAR. So the requirement is when a user selects any month and year in the slicer the total sum would be the sum for the quarter to which the month falls to.

 

rahulrackup_0-1634535693743.png

 

For example if i selct Month( July), Year 2022, i should get values for first quarter(i.e. July, Aug, Sep) of 2022 and 2021 under column name QTD and QTD PY. below is the formula i have used.

 

QTD- CALCULATE ( SUM ( Data[Value] ), PARALLELPERIOD ( 'Calendar'[Fiscal yearDate], 0, QUARTER ) )

QTD PY-  CALCULATE ( SUM ( Data[Value] ), PARALLELPERIOD ( 'Calendar'[Fiscal yearDate], -1, QUARTER ) )

But numbers are not coming up for QTD-PY. Please help to fix this up

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rahulrackup , Hope you have date table , with time intelligence

 

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])))

 

Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0

View solution in original post

2 REPLIES 2
rahulrackup
Employee
Employee

Hi Amit,

Thanks for your response but for previous year quarter it is not working. please see below snip.

rahulrackup_0-1634566326386.png

 

 

For example if i select year 2022 and month Jul, i should be able to see current and previous year quartern i.e. ( Jul, Aug and Sep) quarter value for 2022 and 2021.below formula is not working for QTD PY

 

QTD PY- CALCULATE ( SUM ( Data[QTY] ), PARALLELPERIOD ( 'Calendar'[Date], -1, QUARTER ) )

amitchandak
Super User
Super User

@rahulrackup , Hope you have date table , with time intelligence

 

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])))

 

Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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