Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Kelliesy
Contributor III
Contributor III

YoY Differences by Quarter

Previous community post solutions did not solve my current issue so I'm creating a new post.

I want to show the change in Sales from quarter to last years quarter, i.e., Jan 2025 - Jan 2024.  I have a Quarter Start Date field (mm/dd/yyyy) and a Sales ($$$) field.  The Above function doesn't work because I'm comparing Quarters not Years.  I've tried a bunch of different aggr using set analysis but nothing has worked.  

If anyone needs more info to assist please let me know.

Thanks!

Labels (2)
2 Replies
Vegar
MVP
MVP

To calculate the diff you would need to calculate the Jan-Mar 2025 and the Jan-Mar 2024

Jan-Mar 2024:

=sum({<[Quarter Start Date]={'01/01/2024'}>}sales)

Jan-Mar 2025:

=sum({<[Quarter Start Date]={'01/01/2025'}>}sales)

 

The diff will then be:

=sum({<[Quarter Start Date]={'01/01/2025'}>}sales) -sum({<[Quarter Start Date]={'01/01/2024'}>}sales)

 

Kelliesy
Contributor III
Contributor III
Author

Yes, but how do I do it dynamically?  I have a grid with Quarter Start Date so I want to say sum (Sales)/sum({<"insert code that says quarter start date = year(quarter start date) -1".}sales).  The issue is nothing I try does it dynamically.  Here are a few things I've tried

Sum(Sales)-
AGGR(Sum(If(Quarterstart = AddYears(QuarterStart, -1),
Sales)),QuarterStart)

also same formula but written in Set analysis.  I have also tried multiple variations of this with no success.  The most I've gotten ti to do is bring back the Sales for the Quarter Start listed on the grid.  It always ignores the - sales from previous year quarter.