Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis expression for previous month details

Hello

I converted below pivot table to a straight table  and next to the closing stock, i want to add up closing stock for previous month (i.e. if the diagram shows Feb 2014 figures, i want a new field 'Closing stock for previous month' reflecting data for Jan 2014 for which i gave expression as

Sum({<Year={"=$(=max(Year))"},Month_Name=,Month={"<=$(=Max(Month)-1)"}>}[Closing Stock(Unit)])

It gives me incorrect result, how can it be achieved?

header.jpg

Thanks

7 Replies
Anonymous
Not applicable
Author

try with

=sum({<Month_Name={"$(AddMonths(Month,-1))"}>}  [Closing Stock(Unit)])

Marc.

Not applicable
Author

doesnt give any result

Anonymous
Not applicable
Author

Could you please attach a sample file?

Marc.

PrashantSangle

Hi,

As you say you want Closing stock of Previous Month then

Month={"<=$(=Max(Month)-1)"}

Condition wont work for you

Since you have to write

Month={"$(=Max(Month)-1)"}

then your expression became

Sum({<Year={"=$(=max(Year))"},Month_Name=,Month={"$(=Max(Month)-1)"}>}[Closing Stock(Unit)])

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable
Author

Add an equal sign:

=sum({<Month_Name={"$(     =     AddMonths(Month,-1))"}>}  [Closing Stock(Unit)])


Marc.



Not applicable
Author

Thanks, but i have already used it, it doesnt give me correct figures

jyothish8807
Master II
Master II

Hi,

Try this:

Sum({<Year=,Month_Name=,Month={"$(=Date((Max(Month)-1),'MM-YY')"}>}[Closing Stock(Unit)])

Regards

KC

Best Regards,
KC