Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
philpelll
Contributor
Contributor

Display on the same chart sales from one month purshases from previous month

Hello, 

I'm looking for some help because I'd like to display on the same line chart : 

- Sales of Month M

- Purchases of Previous Month M-1

For that, I've created a dimension Month_Previous = AddMonths(Month,-1)

Then, I though that a measure as followed would have worked : Purchases_Previous_Month = Aggr(sum(Purchases),Month_Previous), if I display the line chart as followed : dimension equals to Month and Measures equal to Sales and Purshases_Previous_Month

But Purchases_Previous_Month displays Purchases. I guess it is a matter of context but I don't know how to handle it. 

Hope someone would help me with it !

Thank you !

Labels (4)
1 Reply
dplr-rn
Partner - Master III
Partner - Master III

whats the dimensions you  have.

typically you do it like so

your dimension

2 measures 

current month - Sum(  {<MonthYear={'$(=Max(MonthYear))'}>}  LineSalesAmount)

previous month - Sum(  {<MonthYear={'$(=Date(AddMonths(Max(MonthYear),-1),'MMM-YYYY'))'}>}  LineSalesAmount)