cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rahulrackup
Microsoft
Microsoft

Calculating current and prior year quarter data 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 but the problem is there are two separate slicers one for 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.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I suggest using the PARALLELPERIOD function in DAX.

 

Check the below picture and the attached pbix file.

 

 

Picture1.png

 

QTY ALL in the same Q : =
CALCULATE ( SUM ( Data[QTY] ), PARALLELPERIOD ( 'Calendar'[Date], 0, QUARTER ) )

 


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

4 REPLIES 4
rahulrackup
Microsoft
Microsoft

Hi Jim,

 

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

rahulrackup_0-1634536499470.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 ) )

 

Jihwan_Kim
Super User
Super User

Hi,

I suggest using the PARALLELPERIOD function in DAX.

 

Check the below picture and the attached pbix file.

 

 

Picture1.png

 

QTY ALL in the same Q : =
CALCULATE ( SUM ( Data[QTY] ), PARALLELPERIOD ( 'Calendar'[Date], 0, QUARTER ) )

 


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

Hi Jim,

 

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

rahulrackup_0-1634804547435.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 ) )

 

Hi,

I think your measure is showing the previous quarter, not the previous year.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors