Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

10 Replies
oknotsen
Master III
Master III

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

inmonth ‒ QlikView

May you live in interesting times!
Anonymous
Not applicable
Author

try addmonths(CM,-1)

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

Not applicable
Author

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,

Anonymous
Not applicable
Author

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?

Anonymous
Not applicable
Author

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:

=sum({<CalendarYear={$(=max(CalendarYear))},CalendarMonthName={$(=month(addmonths((max(InvDate)),-1)))}>}INVC_ITEM_AMT)

Anonymous
Not applicable
Author

Not applicable
Author

VS.PNG

Anonymous
Not applicable
Author

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

sum({<yourdatefield={'$(=addmonths(max/(yourdatefield),-1)'}>}value)

you select month: you get months value

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

Not applicable
Author

Hi Rudie, It worked(sum({<yourdatefield={'$(=addmonths(max/(yourdatefield),-1)'}>}value)),

THANK you so much