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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
marcoyukon
Creator
Creator

Table, current vs previous month columns.

I have a table and I am trying to get the current vs previous month volume numbers side by side. I am getting "0"' for the Prior month measure. I am not sure what I am doing wrong..

[ProductionDate.Calendar.YearMonth], [Volume] , [Previous Month Volume]

2016-Jan, 121, 0

2016-Feb, 132,0

[Previous Month Volume]:

SUM( { $<

  [ProductionDate.Calendar.Year]    = { $(=Year (addmonths(ProductionDate,-1))) } ,

  [ProductionDate.Calendar.Month]     = { $(=Month(addmonths(ProductionDate,-1))) }

        >} Volume )

Attached is the sample .qvf

Regards

8 Replies
Anonymous
Not applicable

Hi Marco Barroso,

Please find the attached qvf and let me know if you have any questions.

Thanks

Mouna

marcoyukon
Creator
Creator
Author

I had looked into "above(sum(Volume))" alternative, however the solution is constrained on the scope of what you can view on the table. For instance, if you filter a row for a month, the prior period will be NULL. Also there is the issue if you sort on the ProductionDate column.

Anonymous
Not applicable

I got it, Please find the attached qvf file. I think this should work as you expected.

arvind_patil
Partner - Specialist III
Partner - Specialist III

HI Marco,

I think it will work for you:

SUM( { $<

  [ProductionDate.Calendar.Year]    = { $(=Year (addmonths(ProductionDate),-1)) } ,

  [ProductionDate.Calendar.Month]     = { $(=Month(addmonths(ProductionDate),-1)) }

        >} Volume )

Thanks,

Arvind Patil

arvind_patil
Partner - Specialist III
Partner - Specialist III

HI Marco,

Also try this one:

SUM( { $<  [ProductionDate.Calendar.Month]     = { $(=addmonths(ProductionDate),-1) }

        >} Volume )

Thanks,

Arvind Patil

marcoyukon
Creator
Creator
Author

Thank you. This did the trick, but why would this expression not work ? It appears the syntax is correct..

SUM( { $<

  [ProductionDate.Calendar.Year]    = { $(=Year (addmonths(ProductionDate,-1))) } ,

  [ProductionDate.Calendar.Month]     = { $(=Month(addmonths(ProductionDate,-1))) }

        >} Volume )

Anonymous
Not applicable

I think it is better o go with peek funtion in the back end

Anonymous
Not applicable

I am not sure whats wrong with the above expression. Any ways if it is helpful please close the threat by marking it correct.

Thanks

Mouna Chandra