Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aleksas_baltpool
Contributor II
Contributor II

Display previous month data

Hi,

I'd like to have a column that shows data from a previous month. Tried doing this with set analysis however with no luck.

Script regarding this table looks like that:

aleksas_baltpool_0-1594818963077.png

I'm using hau_month as a dimension in the chart. I'd like to display sum(hau_total_amount) for the current and for the previous month. 

 

Tried something like that: sum({<hau_month={$(=Max(hau_month)-1)}>}hau_total_amount)

 

However the result is zeroes. Hope you can help me with it !

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Above(sum(hau_total_amount), 2)

View solution in original post

12 Replies
basav
Creator
Creator

Hi,

What type of chart you are trying to create. 

Did you try bar chart,  with month(hau_month) in the dimension, and sum(hau_total_amount) as expression. This should show month wise data. 

It would be better if you upload a sample QVW or screenshots along, this will help us give you correct answer. 

cheers,

Basav

aleksas_baltpool
Contributor II
Contributor II
Author

Hi, I'm creating a table chart. There is no problem displaying data month wise, however in this case I need to display previous period (month) data in the same column. What would you like to see in the screenshot?

basav
Creator
Creator

Hi,

Please always try to attach sample QVW with sample data, if a precise answer is required. 

Please check these posts, hope these helps:

https://community.qlik.com/t5/New-to-QlikView/Show-previous-month-data/td-p/1246957

https://community.qlik.com/t5/QlikView-App-Development/How-to-show-previous-month-data-in-current-mo...

cheers,

Basav

aleksas_baltpool
Contributor II
Contributor II
Author

I've already checked those topics before posting but didn't manage to adapt formulas to my document. 

 

I've uploaded sample file.

tresesco
MVP
MVP

Try this expression:

=sum(TOTAL {<MonthYear={'$(vPrevMthNo)'}>}[Total Stock])

tresesco_0-1594879342502.png

 

aleksas_baltpool
Contributor II
Contributor II
Author

Would it be possible for you to edit this expression according to the sample file I've uploaded? That would be a big help!

tresesco
MVP
MVP

Sorry, I didn't get you. I have already edited your expression , i.e. - added 'total' in the expression.

aleksas_baltpool
Contributor II
Contributor II
Author

Oh sorry wrong file uploaded...

 

This is correct one:

tresesco
MVP
MVP

When you use month as dimension, try like:

Above(sum(hau_total_amount))