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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference in last month value

Hi all,

I am using two different expressions like below:

1. To get the count of last month in KPI. Getting value as 5430.

count({$<MonthPeriod= {"$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id)

2. This measure in line graph which shows the values of months. in this graph for the last month value it's showing value as 5428.

Count({$<DateType = {'invitation'},MonthPeriod = {"<$(=Max(MonthPeriod))"}>}invitation_id)

As i am showing the value of same month it should be same, but it is mismatch.

Correct count/value is = 5428.

Finding difficulty to find where i am doing wrong.

Monthperiod is a field created using load script.

Month(weekend(CanonicalDate)) as MonthPeriod

I tried with Max(MonthPeriod)-1 it's not working because monthperiod is like 'Dec' but this gives output as 11.

In 1 I am getting wrong count any one please help on this.

Regards,

Pramod

13 Replies
Not applicable
Author

count({$<MonthPeriod= {"<$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id)


returns the same as:


count({$<MonthPeriod= {"$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id) ?


one should return a count of invitation_id up to and including the Previous Month

the other should return a count of invitation_id for the Previous Month

Not applicable
Author

Yes, but this is returning wrong count

count({$<MonthPeriod= {"$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id)



This will return 5430 as count of invitation for nov month

count({$<MonthPeriod= {"<$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id)


But 1st expression return 5428 for Nov month

Not applicable
Author

Your original post had two formulas:

1. count({$<MonthPeriod= {"$(=Month(AddMonths(Today(),-1)))"}, DateType= {'invitation'}>} invitation_id)

2. Count({$<DateType = {'invitation'},MonthPeriod = {"<$(=Max(MonthPeriod))"}>}invitation_id)

1. Says MonthPeriod = November

2. Says MonthPeriod < December

"= November" is not the same as "< December" as October is also < December

Not applicable
Author

That's fine you can see in above image that  "< December" is used for line graph.

then the month value should be same right.

I have cross checked in DB the value is 5428, i don't know from where 2 is adding for Nov month