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: 
mohamed_ahid
Partner - Specialist
Partner - Specialist

Sub total issue

Hi every body,

I'm working on a pivot table like this :

LevelCanalCost this yearCost last yearWeignt
RENAGELHP48655641,6546.22%
MT35065641,6533.31%
GP21541927,820;46%
Total 105251927,8100%

for facts columns i used this formulas :

Cost this year : set analysis over Cost column using a varibles which returns this year number :

 

=sum({<Level={'level1'},Year={$(=year_n)}>}cost) 

Cost last year : same thing this the formula :

=sum({<Level={'level1'},Year={$(=year_n-1)}>}cost)

my question is what is the formula to calculate weight like in the  table ? 

exmple : 46.22%=(4865/10525)*100

THX

10 Replies
Not applicable

Use below expression

num(sum(Cost)/sum(total Cost), '#,##0%')

Sokkorn
Master
Master

Hi,

Your [Weignt] column should have expression Num([Cost this year]/[Cost last year],'#,###.00%')

Regards,

Sokkorn

mohamed_ahid
Partner - Specialist
Partner - Specialist
Author

thanx for your answer but this will not work, i tried it before .

because i need to calculat sum(total cost) for this year.

see formulas above.

mohamed_ahid
Partner - Specialist
Partner - Specialist
Author

no it should have  expression cost this year/total cost this year

Not applicable

Can u post ur qvw file?

it would be great.

techvarun
Specialist II
Specialist II

(Salesthis year - Saleslast year) / Saleslast year * 100

techvarun
Specialist II
Specialist II

100-(Cost last year/Cost last year%)

techvarun
Specialist II
Specialist II

both will work

Not applicable

Hi,

Why don't to try like (Column(3)/Column(4))*100 in your expression weight?

here Column(3) is "Cost is this year" and Column(4) is "Cost last year".