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: 
Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II

Dealing %

Hello:

I have an expression to calculate the % of a total, I need a second expression that accumulate he previous % ... but I'm not able to write it.

Please, could you help me?

This is the expression

NUM( 100 *

      SUM( Sales )       

    / SUM( TOTAL Sales)        

    , $(NumberFormat2Dec), DecimalSep, ThousandSep)

And this is the table that i can't get

Image1.PNG.png

Which expression i need write in column 2 ??

Thank you very much,

Joaquín

1 Solution

Accepted Solutions
Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Hi guys:

The correct expression for column2 is:

= NUM( 100 *

    RangeSum(Above(SUM( Sales ), 0, RowNo()))

     / SUM( TOTAL Sales )

, $(NumberFormat2Dec), DecimalSep, ThousandSep)

and it works under two conditions: a) The chart must be a straight table and b) Only with one dimension

Thanks again

View solution in original post

8 Replies
tresesco
MVP
MVP

rangesum (above(sum(x),0,2))

//'x' should be replaced by the label of the first column/Column(1).

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Thanks tresesco

I've written rangesum (above(sum(x),0,2)) in second expression and tagged column 1 as x

The value of column2 is 0 for all the rows

er_mohit
Master II
Master II

Try this

rangesum(above(sum(Sales),0,rowno(total)))

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Image3.PNG.png

Image2.PNG.png

tresesco
MVP
MVP

Sorry, Sum() should not be there. try:

rangesum (above(x,0,RowNo(Total)))

RowNo(Total) - would be required to sum up till the end.

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Hi:

= rangesum(above(X,0,2))

= rangesum(above('X',0,2))

In both cases I get 0 for all the rows ... the first is marked as wrong expression it editor because is not a field name (X is the tag of the expression

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Thanks ER.Mohit:

Column 2 values are 0 too

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II
Author

Hi guys:

The correct expression for column2 is:

= NUM( 100 *

    RangeSum(Above(SUM( Sales ), 0, RowNo()))

     / SUM( TOTAL Sales )

, $(NumberFormat2Dec), DecimalSep, ThousandSep)

and it works under two conditions: a) The chart must be a straight table and b) Only with one dimension

Thanks again