Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show the previous values data

Hi,

I hv list box with fieldname as month with values jan,feb,mar,.....

i hv pivot table with prodname,current_sale,previous_sale

i need previous row to be get displayed in previous_sale if my current selection is march it should show the sale of feb...

if feb then sale of jan to be get displayed

how to show the previous row datas easily....

pls help me out,,,

2 Replies
syed_muzammil
Partner - Creator II
Partner - Creator II

Hi,

Add another field in your table as Month number. Its better if you are using a calendar jus add another field as num(Month). In your expression you can use the month no . Also add a Variable vPrevMonth = num(Month)-1

eg: Sum({<MonthNo={$(#vPrevMonth)>} Sales)

Regards,

Syed.

johnw
Champion III
Champion III

Set analysis will work, but ONLY if a single month is selected. A set is built once for the entire table, so if multiple months are selected, it fails.

My usual suggestion is therefore to build an AsOf table. You wouldn't do an inline load like this, but to give the idea of the data structure:

AsOfMonth, MonthType, Month
Oct 2010, Current, Oct 2010
Oct 2010, Previous, Sep 2010
Sep 2010, Current, Sep 2010
Sep 2010, Previous, Aug 2010

Then use AsOfMonth instead of Month in your pivot table, and add MonthType as a dimension. Then the expression is a simple sum(Sales), with no conditional logic.