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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
msawyercke
Creator
Creator

Expression to use for 'Comparable' Locations

Good Morning!

I load data for each of our locations that contains sales performance.  It is structured like this:

Unit #     

Current Year Sales ("CY TP 13")   

Year Ago Sales   ("PY TP 13") 

From there, I use the following formula to highlight % Change Vs Ya

AVG ([CY TP 13])/avg([PY TP 13])-1

The problem is, I need to create a chart (perhaps a TreeMap), that only displays the data of 'comparable' locations, since some locations that are reporting sales this year weren't open last year, distorting the % change statistic.  In other words, I want to calculate locations where PY TP 13>0.

In my example, what would the expression be in the expression editor?

Thanks for any help that can be provided?

13 Replies
msawyercke
Creator
Creator
Author

I sum CY, then Sum LY, then use the formula (Sum CY/Sum LY)-1

msawyercke
Creator
Creator
Author

Capture.JPG

sunny_talwar
MVP
MVP

Try this:

Sum({<[Comp_Flag] = {1}>} [CY TP 13])/Sum([PY TP 13]) - 1

msawyercke
Creator
Creator
Author

Outstanding!!  Thank You, Sunny!!