Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tinkerz1
Creator II
Creator II

Using set analysis to get the count of previous month in a pivot table

Hi,

I have set up a simple count expression using a pivot table and would like to get the numbers for the previous month.

This is so I can get a % change between last and this month.

The set analysis is not bringing the count of all reference numbers less than the date selected, it seems to pivot them out across the month pivot.

Where am I going wrong? I this more of an suitable aggr formula?

I expect to see 26 in all the cells where the set analysis is.

Thanks.

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Also as you are using monthend dates

use the below expression

count(TOTAL <TABLE>  {$<Month={"$(=date(MONTHEND(Addmonths([Month],-1)),'DD/MM/YYYY'))"}>} Reference)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

Try

count(TOTAL <TABLE> {$<Month={"$(='<=' & Date(Today(),'DD/MM/YYYY'))"}>} Reference)

OR Preferably below,

count(TOTAL <TABLE>  {$<Month={"<=$(=Date(Today(),'DD/MM/YYYY'))"}>} Reference)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
tinkerz1
Creator II
Creator II
Author

Thanks Vineeth that works.

My next step is to bring forward last months data into the pivot table when month is selected.

count(TOTAL <TABLE> {$<Month={"=$(=date(Addmonths([Month],-1),'DD/MM/YYYY'))"}>} Reference)

I have updated the original qvw, I don't understand why when using addmonth why the balance of the previous number is not working

Thanks

vinieme12
Champion III
Champion III

remove the EqualSign in RED

count(TOTAL <TABLE> {$<Month={"=$(=date(Addmonths([Month],-1),'DD/MM/YYYY'))"}>} Reference)


and just use

count(TOTAL <TABLE> {$<Month={"$(=date(Addmonths([Month],-1),'DD/MM/YYYY'))"}>} Reference)


The Little Equals Sign

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Also as you are using monthend dates

use the below expression

count(TOTAL <TABLE>  {$<Month={"$(=date(MONTHEND(Addmonths([Month],-1)),'DD/MM/YYYY'))"}>} Reference)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
tinkerz1
Creator II
Creator II
Author

Hi,

Can you explain briefly what TOTAL <fieldname> does?

Did it group everything around <TABLE>?

vinieme12
Champion III
Champion III

Yes, that is correct

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.