New to Qlik Analytics

If you’re new to Qlik Cloud or Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!

Who Me Too'd this topic

Nickolay1
Contributor III
Contributor III

Set analysis does not work for previous month selection

Dear Community,

Hopefully you will be able to help me with this question. I need to calculate a measure which corresponds to the previous month from the one that is currently selected in the filter (for example if September is selected the measure should be calculated for August). I am trying to use following formula: 

count({<[Data Month - Year]={'$(=addmonths([Data Month - Year],-1))'}>} [Batch Number])

Field [Data Month - Year] has date format as for example 01/09/23. If I use it without set expression just to show the date it works correctly: if 01/09/23 is selected the formula Addmonths([Data Month - Year],-1) shows 01/08/23

But somehow the formula to count batches shows 0:

count({<[Data Month - Year]={'$(=addmonths([Data Month - Year],-1))'}>} [Batch Number]) 

If I try to add = sign before $ it calculates total number of batches for September (currently selected month):

count({<[Data Month - Year]={'=$(=addmonths([Data Month - Year],-1))'}>} [Batch Number]) 

If I try to add currently selected month to be ignored the result is still 0:

count({<[Data Month - Year],[Data Month - Year]={'$(=addmonths([Data Month - Year],-1))'}>} [Batch Number])

Any help would be highly appreciated! Thanks a lot in advance! 

 

 

Labels (3)
Who Me Too'd this topic