Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Previous Month Value

Hi All

In the attached example ,

if there are no filters applied , Am able to see the Current month and Previous month record.

But if i select any month , only the current month value is displayed, the previous month is zero.

I want to find the previous month also

Note : Values are in Text Object

1 Solution

Accepted Solutions
MVP
MVP

Re: Previous Month Value

If your set expression is modifying Date field, you need to clear also possible user selections in other  calendar fields, to avoid incompatible field selections:

='Last Month: ' & Count(DISTINCT {<Date={'>=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=Date(AddMonths(Max(Date), -1)))'}, Month, NumMonth, Year>}  [Sam Ref Id])

2 Replies
MVP
MVP

Re: Previous Month Value

If your set expression is modifying Date field, you need to clear also possible user selections in other  calendar fields, to avoid incompatible field selections:

='Last Month: ' & Count(DISTINCT {<Date={'>=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=Date(AddMonths(Max(Date), -1)))'}, Month, NumMonth, Year>}  [Sam Ref Id])

Re: Previous Month Value

Use this expression for last month:

='Last Month: ' & Count(DISTINCT {<Date={'>=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=MonthEnd(AddMonths(Max(Date), -1)))'}, NumMonth = , Month = , Year = >}  [Sam Ref Id])

Note the red part, if don't use MonthEnd, you will not cover the whole month. For example if your max(date) is 24/04/2015 you will get previous month's value for 01/03/2015 - 24/03/2015. and my guess is that you would like to know the count from 01/03/2015 - 31/03/2015?? If my guess is wrong then swuehl‌ solution is the one you are looking for.

Best,

Sunny

Community Browser