
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
previous month count
Hi All,
I am trying to find a % change from selected months sales to previous month sale. I have data from Jan to Sep . and filter pane in which values are (Jan, feb, mar to sep) so if I select months, the % change will appear in the KPI.
How should I write set expression keeping these condition in mind? Date field format (2020 -04-24)
Please help!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something like I've done below.
Sum(sales) / sum({<Month=, Date={">=$(=monthstart(min(Date), - 1)) <$(=monthend(min(Date),-1)) >} Sales)
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vegar
this is what I am getting . Day_fact is my date field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
PFB I have edited the expression as per data. Day_fact is my date field. it shows null value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See my minor adjustments ' '.
Count (distinct patient_id) / sum(distinct {<Month=, day_fact={">='$(=monthstart(min(day_fact), - 1))' <'$(=monthend(max(day_fact),-1))' >} patient_id)
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
output

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Ayushs try below
Count (distinct patient_id) / sum(distinct {<Month=, day_fact={">=$(=date(monthstart(addmonths(max(day_fact), - 1))))<=$(=date(monthend(addmonths(max(day_fact), - 1))))" }>} patient_id)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's wrong with the output?
By the way, it does not look like you are selecting a single month in the screenshot you posted. Your intensely is larger than a month. If so, what period do you want to compare with?
Qlik Community MVP
