10 Replies Latest reply: Aug 30, 2016 8:50 AM by Onno van Knotsenburg

# Expression

Hi There,

I want to create an expression to look at the the sameday on Current month and previous month, for instance

CM = 20160801 to 20160830

PM = 20160701 to 20160730

Many thanks,

Treasure

• ###### Re: Expression

Maybe the inmonth() function is what you are looking for.

inmonth ‒ QlikView

• ###### Re: Expression

how your Expression would look like to Combine sameday value of CM and PM?

• ###### Re: Expression

Hi Rudolf,

I have two Charts (one showing CM and the other showing PM)

so on the current month chart(there's data from the first of this month until today),

and on the previous month chart(there's data from the first of the previous month until month end (20160731)

so I want to compare 30th of this month and the 30th of the pm

thanks,

• ###### Re: Expression

you may use the Expression with addmonths in your Chart with PM

do you show each day of month in the Chart?

can you post sample qvw?

• ###### Re: Expression

you wrote that you want to compare the sameday from current month and previous month

but you want to compare the current month vs previous month? or do you select the day by a selection box?

anyway: if you define the Expression for PM like

you select month: you get months value

you select day and month: you get value of this month/day

• ###### Re: Expression

THANK you so much

• ###### Re: Expression

If not, please make clear what part of this topic you still need help with .

• ###### Re: Expression

may be like this?

Create two variables

1. vCurrentMonth

=Max(Month)

and make ur expression like:

sum( {\$<Year = {\$(#vCurrentMonth)}>} Sales )

2. vLastMonth

=Max(Month-1)

sum( {\$<Year = {\$(#vLastMonth)}>} Sales )

or

For Current Month Sales:

=sum({<CalendarYear={\$(=max(CalendarYear))},CalendarMonthName={\$(=Month(Max(InvDate)))}>}INVC_ITEM_AMT)

For Last Month Sales: