Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
asmith_rc_23
Contributor II
Contributor II

Calculate Previous Month Record Count

We have a calculation in an app that Gets count of records from previous month. 
All individual variables seem to be working. 
however, the calculation returns zero.

 

Calc=  count({$<RecordCurrent_Month = {"Previous_Month_End"}>}Month_end_note_id)

WHERE

RecordCurrent_Month = date(DATA_DATE,'MM/YY') 

Previous_Month_End = date(addmonths(DATA_DATE,-1),'MM/YY') 

Labels (2)
1 Solution

Accepted Solutions
rpennacchi
Contributor III
Contributor III

I am sharing a .qvf file showing how I would solve this using The As Of Table.

All you need to know about that is described on this post: The As Of Table . I don't think I can explain better than Hic.

 I hope it solve your needs.

 

Find me on linkedin:
https://www.linkedin.com/in/rodrigo-pennacchi/

View solution in original post

9 Replies
Gabbar
Specialist
Specialist

This set analysis is going row wise, so there is no data where current_month=previous_month in backend in the same row,
try this
Calc=  count({$<RecordCurrent_Month = {"=$(=date(addmonths(DATA_DATE,-1),'MM/YY') )"}>}Month_end_note_id) it should

work when data can be in tabular format like in charts and table.

asmith_rc_23
Contributor II
Contributor II
Author

Gabbar,

Thanks for reaching out.

i had to replace data_date but otherwise i copied the above. I verified that the addmonths calc works too.

count({$<RecordCurrent_Month = {"=$(=date(addmonths(common_loan_wam_month_end_date,-1),'MM/YY') )"}>}Month_end_note_id)

 

The above returns zero still. I am using a pivot table, not sure if that plays a factor.

Thank you,

 

Alec

Gabbar
Specialist
Specialist

Try this:
count({$<RecordCurrent_Month = {"=$(=date(addmonths(RecordCurrent_Month,-1),'MM/YY') )"}>}Month_end_note_id)

asmith_rc_23
Contributor II
Contributor II
Author

No luck. date(addmonths(RecordCurrent_Month,-1),'MM/YY') is valid however. 

Results in the screen shot, even included the previous month calculation 

AlecRC23_0-1678213067218.png

 

Gabbar
Specialist
Specialist

Please share a sample dataset for the same.

asmith_rc_23
Contributor II
Contributor II
Author

Sure, here is an xlsx of the non-sensitive data involved. 

This should be enough  @Gabbar 

Gabbar
Specialist
Specialist

Will update the solution as soon as i am able to find, till then 
try this:
Above('Your Normal Set expression of current month')  
Sort your data in ascending order according to recordcurrent_month

rpennacchi
Contributor III
Contributor III

I am sharing a .qvf file showing how I would solve this using The As Of Table.

All you need to know about that is described on this post: The As Of Table . I don't think I can explain better than Hic.

 I hope it solve your needs.

 

Find me on linkedin:
https://www.linkedin.com/in/rodrigo-pennacchi/
asmith_rc_23
Contributor II
Contributor II
Author

So sorry for the delay. @rpennacchi solution worked.

Thank you all for your efforts.