Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create variance from 2 month total customers?

I have 3 fields -

1) type of account A,B,C

2) total customers

3) month id - 201206 and 201112

I would like to create variance by total customers by type of account for the 2 month id.

I am using create expression to create

1) Current month total customers -

 

sum

({date={'2012-06'},[Mth Id]}[total Cust])

2) previous month total customers

sum({<date={"$(=Date(AddMonths(date,-6),'YYYY-MM'))"},[Mth_Id]=>}[Total Cust])

3) variance

[current month total customers] - [previous month total customers]

But the above does not work. Anyone can help?

2 Replies
Not applicable
Author

Hi,

What is the logic to select the two months? I mean would you always need Variance between those two months?

Regards

R

Not applicable
Author

check your syntax, it should be:

1) Current month total customers

 

sum({$<date={'2012-06'},[Mth Id]=>}[total Cust])

2) previous month total customers

sum({$<date={"$(=Date(AddMonths(date,-6),'YYYY-MM'))"},[Mth_Id]=>}[Total Cust])


3) variance

[current month total customers] - [previous month total customers]