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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
arulsettu
Master III
Master III

get current month vs previous month

hi

i am trying to show current month vs previous month in bar chart

what i did is

sum({<FiscalPeriod={$(=max(FiscalPeriod)),$(=max(FiscalPeriod)-1)}>}Customer)

it shows maximum month and previous month

how can i show current vs previous month any help?

24 Replies
arulsettu
Master III
Master III
Author

any help?

Not applicable

Hi:

If Month field only contain the month part of a date such as Jan, Feb, Mar, I guess Max(Month) will show you Dec.

Your FiscalPeriod field only have Month number from 1 to 12. So I am thinking Max(FiscalPeriod) will give you 12.

Let's say you have a full date field called FullDate.

If you use MonthStart(FullDate) AS MonthStart, it will give you the first date of the month.

For example, any dates in September 2014 will give you 01/09/2014. Any dates in September 2013 will give you 01/09/2013. In that case, you can select the current month record by selecting 01/09/2014 in MonthStart field only.

I think then you can use the following:

Sum({<MonthStart={$(=MonthStart(Today()))), $(=MonthStart(AddMonths(Today(),-1)))} >} Customer)

And change the Dimension to MonthStart.

Thank you.

PC

Not applicable

If you don't want to change your script, I don't think you can select current month by using only FiscalPeriod in your set analysis.

Try to add the FiscalYear as well. Like FiscalYear = Year(Today())

Thank you.

PC

Not applicable

Try this,

if you are looking for Current and previous month,

sum({<FiscalPeriod={$(=max(Num(Month(Date(Today()))))),$(=max(Num(Month(Date(Today()))))-1)}>}Customer)

arulsettu
Master III
Master III
Author

thank you every one....