# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Valued Contributor II

## Set Expression Month = {"<=\$(=max(Month)-1)"} Does not return last month sales

Hi All

Below expression return current month sales correctly :-

Sum(Aggr(SUM({

<

year = {\$(=only(year))},

Month = {"<=\$(=max(Month))"},

rEVENUE={rEVENUE}

>

}Amount*1)/\$(Columndim89)/1000, \$(ColumnDim101)))

I modify the above exoression to get the last month revenue as below :-

Sum(Aggr(SUM({

<

year = {\$(=only(year))},

Month = {"<=\$(=max(Month)-1)"},

rEVENUE={rEVENUE}

>

}Amount*1)/\$(Columndim89)/1000, \$(ColumnDim101)))

I get null value , can some one advise me where i go wrong ?

Paul

1 Solution

Accepted Solutions
MVP

## Re: Set Expression Month = {"<=\$(=max(Month)-1)"} Does not return last month sales

Try this:

Sum(Aggr(SUM({

<

year = {\$(=only(year))},

Month = {"<=\$(=max(Month)-1)"}, month, year,

rEVENUE={rEVENUE}

>

}Amount*1)/\$(Columndim89)/1000, \$(ColumnDim101)))

3 Replies
Valued Contributor II

my qv doc

MVP

## Re: Set Expression Month = {"<=\$(=max(Month)-1)"} Does not return last month sales

Try this:

Sum(Aggr(SUM({

<

year = {\$(=only(year))},

Month = {"<=\$(=max(Month)-1)"}, month, year,

rEVENUE={rEVENUE}

>

}Amount*1)/\$(Columndim89)/1000, \$(ColumnDim101)))

Valued Contributor II

## Re: Set Expression Month = {"<=\$(=max(Month)-1)"} Does not return last month sales

Hi Sunny

Thank you very much for your advise again. But i try your expression return 3374 , how to make it display 947  ? Same as Table 2

Paul