Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
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.