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: 
sergeyko
Partner - Creator
Partner - Creator

Transforming data in AsOf table

Hi there,

I've created an AsOf table to comply with my use case of calculating a month-over-month ratio - see the link below for more details:

https://community.qlik.com/t5/New-to-Qlik-Sense/Trying-to-calc-month-over-month-ratio-of-current-vs-...

A twist in the ratio I need to calculate is that it is not just current / past, but the current must only include items that existed in the past month and sum their prices capped to the prices of the same items from the previous month. 

My data looks like as follows:

My ratio for Jan 2017 looks like (sum of past month) - (limited sum of current month) / (sum of past month)

Hence, (160+240+400) - (150+240[price of item 125 is capped to its previous amount]+0[item 135 is missing in past]) / (160+240+400)

I think I need to transform my data to introduce a couple of new columns:

a) The one that will say whether the current item has its duplicate in the past month

b) The other that will store capped prices of items

 

I would appreciate your suggestion on how to make those transformations on the data loading stage. If you have ideas how to make it work on the frontend, I am certainly open to them as well.

 

YearMonthYearMonth_AsOfTableFlagItem #Price
Jan 2017Jan 2017Current123$150
Jan 2017Dec 2016AsOf123$160
Jan 2017Jan 2017Current125$250
Jan 2017Dec 2016AsOf125$240
Jan 2017Jan 2017Current135$350
Jan 2017Dec 2016AsOf140$400
...............
Labels (2)
10 Replies
sergeyko
Partner - Creator
Partner - Creator
Author

Thank you Gysbert,

That looks like a way to go. I'm going to mark your last reply as a solution to my original problem.

I'm also exprimenting with building an AsOf table through joining the original table to itself so that I can add additional columns and easily manipulate the data afterwards.