Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Nikhil2725
Creator II
Creator II

Addition

Hi Team,

I have a below table.

PH6PH6_descSales T/O
231546BV 5461163729
255373VAG Produkte1092099
221051El. fusion fitti. PB880487
201950Solv.cement fitt.me.874874
230152Solv. Cement Fit. mm689215
202956Ballvalves for water550592
230153Adapter Fittings mm531082
251313ELGEF Plus saddles464251
221043Pipe PB in bars451753
2J1J54Regulierarmaturen432843

 

Further I want to add new column as below. Kindly help me in doing this.

PH6PH6_descSales T/ONew ColumnDescription
231546BV 54611637291163729For the first row the value should be same as Sales T/O(1163729)
255373VAG Produkte10920992255828Addition of 1st row and 2nd row of Sales T/O(1163729+1092099)
221051El. fusion fitti. PB8804873136315880487+2255828
201950Solv.cement fitt.me.8748744011189874874+3136315
230152Solv. Cement Fit. mm6892154700404689215+4011189
202956Ballvalves for water5505925250996550592+4700404
230153Adapter Fittings mm5310825782078531082+5250996
251313ELGEF Plus saddles4642516246329464251+5782078
221043Pipe PB in bars4517536698082451753+6246329
2J1J54Regulierarmaturen4328437130925432843+6698082

 

 

40 Replies
Kushal_Chawda

You are not using the expression which I suggested in my previous post. Try that. If not working please share sample application

Nikhil2725
Creator II
Creator II
Author

Hello,

I have tried your expression as well.

Script.

Table:
LOAD * Inline [
PH6 ,PH6_desc, Sales T/O
231546,BV 546,1163729
255373,VAG Produkte,1092099
221051,El. fusion fitti. PB,880487
201950,Solv.cement fitt.me.,874874
230152,Solv. Cement Fit. mm,689215
202956,Ballvalves for water,550592
230153,Adapter Fittings mm,531082
251313,ELGEF Plus saddles,464251
221043,Pipe PB in bars,451753
2J1J54,Regulierarmaturen,43284
];

Please find the attached file..

Kushal_Chawda

Do some changes.

First Remove Sales T/O from dimension and add it via measure (Sum([Sales T/O])) as it is measure.  Now use below expression

RangeSum(above(total sum({<PH6,PH6_desc>}[Sales T/O]),0,RowNo(total))) *avg(1)

Nikhil2725
Creator II
Creator II
Author

Hello,

As per your suggestion, I changed the expression and I got the output.

But I want to sort the Sales T/O field in descending order.. But I am unable to do it.

I can Only sort PH6 and PH6_desc fields.

Any suggestion??

Kushal_Chawda

you need to use sortable Aggr for this.

https://community.qlik.com/t5/Qlik-Design-Blog/The-sortable-Aggr-function-is-finally-here/ba-p/14702...

 

your final expression will look like below

=sum(aggr(RangeSum(above(total sum({<PH6,PH6_desc>}[Sales T/O]),0,RowNo(total))) ,([Sales T/O],(NUMERIC, ASCENDING)))) *avg(1)
Nikhil2725
Creator II
Creator II
Author

Thanks for the reply,

Please find the attached file. Im getting the wrong output.:(

Kushal_Chawda

What is the expected output when you sort  it descending? Accumulation should start with Highest value? 

Nikhil2725
Creator II
Creator II
Author

I should sort the Sales T/o column in descending order.

corresponding to the sales T/O column i should get the new column value(Cumulative T/O).

PH-6PH-6 nameSales T/OCumulative T/O
231546BV 5461,163,7291,163,729
255373VAG Produkte1,092,0992,255,828
221051El. fusion fitti. PB880,4873,136,315
201950Solv.cement fitt.me.874,8744,011,189
230152Solv. Cement Fit. mm689,2154,700,404
202956Ballvalves for water550,5925,250,996
230153Adapter Fittings mm531,0825,782,077
251313ELGEF Plus saddles464,2516,246,328
221043Pipe PB in bars451,7536,698,081

 

Kushal_Chawda

try changing  (FREQUENCY, DESCENDING) to (NUMERIC, DESCENDING) in aggr function

Nikhil2725
Creator II
Creator II
Author

I tried but no luck..:(