Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need add % of Total Column to pivot table

Hello Everyone,

I need add  % of Total Column to pivot table. I have a qvw  attached. But I want result like excel attached.

Thank you very much for your comments.

Best regards.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi,


Try like below


Script:

Temp:

CrossTable(Parameter, Values)

LOAD Year,

    Funded,

    Unfunded,

    Projected,

    Goal

FROM

[..\Desktop\11.xlsx]

(ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD Year,

'Gap' as Parameter,

Sum(If(Parameter='Goal',Values)) - Sum(If(Parameter<>'Goal',Values)) as Values

Resident Temp Group by Year,Parameter;

Expression:

Values    => Sum(Values)

%          => If(Parameter<>'Goal',Sum(Values) / Sum(Total <Year> {<Parameter -= {'Goal'}>}Values)

Output:

Capture.PNG

View solution in original post

3 Replies
qliksus
Specialist II
Specialist II

Not sure how you got that 50% in the excel but check the attached and let me know if this is what you want

tamilarasu
Champion
Champion

Hi,


Try like below


Script:

Temp:

CrossTable(Parameter, Values)

LOAD Year,

    Funded,

    Unfunded,

    Projected,

    Goal

FROM

[..\Desktop\11.xlsx]

(ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD Year,

'Gap' as Parameter,

Sum(If(Parameter='Goal',Values)) - Sum(If(Parameter<>'Goal',Values)) as Values

Resident Temp Group by Year,Parameter;

Expression:

Values    => Sum(Values)

%          => If(Parameter<>'Goal',Sum(Values) / Sum(Total <Year> {<Parameter -= {'Goal'}>}Values)

Output:

Capture.PNG

Not applicable
Author

Thank you very much - qliksus and Tamil.