Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

Cumulative Expression

Hello,

I would like to create a Cumulative expression, let's call it "Cumulative This Year".

On my Sheet, I have a list box titled "Month", that list the 12 months of the year.

Instead of my field "Cumulative This Year" adding all of the data for for the current year, I want it to stop at the month selected in the List box.

If June is selected as the Month, "Cumulative This Year" will consist data from January - June.

I have the follwing in my expression.  Is there a way to adjust the ''Month" based on the value selected in the List box?

Sum({<DepletionYear= {"12"},Month = {"01","02","03","04"}>} Depletion)

Thanks in advance for your assistance,

Stephanie Smith

Tags (2)
5 Replies
manojkvrajan
Contributor III

Re: Cumulative Expression

Stephanie, Should the application take the max month on selecting multiple months in the list box? 

For example, on selecting May, October and November, should it take January through November? Please confirm.

Not applicable

Re: Cumulative Expression

Yes, that is exactly what I am looking for

daveamz01
Contributor III

Re: Cumulative Expression

Hi Stephanie,

    Set a variable vMonth = Month

then:

Sum({<DepletionYear= {"12"},Month = {"<=$(vMonth)"}>} Depletion)

Regards,

David

Not applicable

Re: Cumulative Expression

Hello David,

That sounds like it will work.  But how to do a set a variable?  Do I put it in my Expression script?

Thanks,

Stephanie

daveamz01
Contributor III

Re: Cumulative Expression

Settings > Variable Overview (Ctrl+Alt+V) > Add > vMonth for variable name, =Month for Definition. Equal sign is mandatory.

Untitled.png