Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
charles1981
New Contributor II

want to create a new column by adding another 3 columns

Hi, Anyone can help me to achieve the below please,

I have a table below:

ScenarioMarketSub Industry19-Jan19-Feb19-Mar19-Apr19-May19-Jun19-Jul19-Aug19-Sep19-Oct19-Nov19-Dec
PIndiaCar3,3903,1504,1353,8773,1755,7173,4424,1924,3874,2344,3905,668
PIndiaTruck1,8291,5912,2051,9781,5923,3241,8062,2242,2872,1892,3683,133

I want to create a new table as below using the above table:

ScenarioMarketSub Industry19-Jan19-Feb19-Mar19-Qtr119-Apr19-May19-Jun19-Qtr219-Jul19-Aug19-Sep19-Qtr319-Oct19-Nov19-Dec19-Qtr4
PIndiaCar3,3903,1504,13510,6753,8773,1755,71712,7693,4424,1924,38712,0214,2344,3905,66814,292
PIndiaTruck1,8291,5912,2055,6251,9781,5923,3246,8941,8062,2242,2876,3172,1892,3683,1337,690

 

here 19-Qtr1 is the sum of 19-Jan,19-Feb and 19-Mar.

Anyone can help me to achieve this please. I don't want to use the column name like [19-Jan] directly
hence it will be different in next year.
I tried to use the straight table with expression (=sum(column(5)+column(6)+column(7)) but its not worked.

 

4 Replies
Shubham_Deshmukh
Valued Contributor

Re: want to create a new column by adding another 3 columns

Hi Charles,
Just add expressions then instead of [19-Jan] like,
=expression for [19-Jan] + expression for [19-Feb] + expression for [19-Mar]
MindaugasBacius
Valued Contributor III

Re: want to create a new column by adding another 3 columns

I suggest you creating Master Calendar with Year and Quater fields.
With those two the script will be more consistent and according to good practice.
charles1981
New Contributor II

Re: want to create a new column by adding another 3 columns

Thank you, I just started learning qlikview, if possible, can you please give some example to understand.

MindaugasBacius
Valued Contributor III

Re: want to create a new column by adding another 3 columns

You need to come up with something like this:

Screenshot_1.jpgScreenshot_1.jpg

Instead of Year week you need Year quarter and instead of Date you need Month.

To get that you need to create Master Calendar or just write in the script this sentence:

Year(DateField) & '-' & Ceil(Month(DateField)/3) as [Year quarter]

Than use Pivot table.

To create Master Calendar:

https://community.qlik.com/t5/QlikView-App-Development/Master-Calendar-for-Quarter-Week-Weekdays-wit...

https://community.qlik.com/t5/QlikView-Scripting/Creating-A-Master-Calendar/td-p/341286

Try google it as there is plenty of information.