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: 
Not applicable

need help

Hi Viewers,

Please have a look at my scenario,I have taken pivot table to accomplish this.

But not getting what exactly am looking for.am getting results in two tables I need to show in one table. As I shown below.

I wanted to confirm whether its possible or not in pivot table

PFB for your reference.

Source Table:   

StateRolehcactgap
apa1110
apa2211
apa3321
tela1211
tela2330
tela3110
tama1312
tama2211
tama3110
kara1220
kara2110
kara3321
krla1110
krla2211
krla3330

Expected Output:

   

Rolea1a2a3Status
Statushcactgaphcactgaphcactgaphcactgap%
ap11021132164267%
tel21133011065183%
tam31221111063383%
kar22011032165150%
krl11021133065183%
Total963107311923022874%

Please suggest me on this.

Thanks in adv!

1 Solution

Accepted Solutions
sunny_talwar

Script

Table:

LOAD * INLINE [

    State, Role, hc, act, gap

    ap, a1, 1, 1, 0

    ap, a2, 2, 1, 1

    ap, a3, 3, 2, 1

    tel, a1, 2, 1, 1

    tel, a2, 3, 3, 0

    tel, a3, 1, 1, 0

    tam, a1, 3, 1, 2

    tam, a2, 2, 1, 1

    tam, a3, 1, 1, 0

    kar, a1, 2, 2, 0

    kar, a2, 1, 1, 0

    kar, a3, 3, 2, 1

    krl, a1, 1, 1, 0

    krl, a2, 2, 1, 1

    krl, a3, 3, 3, 0

];

Dim1:

LOAD * Inline [

Dim1

1

2

];

Dim2:

LOAD * Inline [

Dim2

1

2

3

4

];

Pivot table

Dimensions

State

=Pick(Dim1, Role, 'Total')

=Pick(Dim2, 'hc', 'act', 'gap', '%')

Expression

=Pick(Dim2, Sum(hc), Sum(act), Sum(gap), If(Dim1 = 2, Num(Sum(act)/Sum(hc), '##%')))

Also, enable 'Show Partial Sums' for State dimension from presentation tab

View solution in original post

7 Replies
sunny_talwar

This?

Capture.PNG

sunny_talwar

With Total at the bottom

Capture.PNG

Not applicable
Author

Yes Sunny almost reached.

But how to show totals in below as I shown above.

Please have a look at.

And also please share your script here as am not able to open your file.

sunny_talwar

Script

Table:

LOAD * INLINE [

    State, Role, hc, act, gap

    ap, a1, 1, 1, 0

    ap, a2, 2, 1, 1

    ap, a3, 3, 2, 1

    tel, a1, 2, 1, 1

    tel, a2, 3, 3, 0

    tel, a3, 1, 1, 0

    tam, a1, 3, 1, 2

    tam, a2, 2, 1, 1

    tam, a3, 1, 1, 0

    kar, a1, 2, 2, 0

    kar, a2, 1, 1, 0

    kar, a3, 3, 2, 1

    krl, a1, 1, 1, 0

    krl, a2, 2, 1, 1

    krl, a3, 3, 3, 0

];

Dim1:

LOAD * Inline [

Dim1

1

2

];

Dim2:

LOAD * Inline [

Dim2

1

2

3

4

];

Pivot table

Dimensions

State

=Pick(Dim1, Role, 'Total')

=Pick(Dim2, 'hc', 'act', 'gap', '%')

Expression

=Pick(Dim2, Sum(hc), Sum(act), Sum(gap), If(Dim1 = 2, Num(Sum(act)/Sum(hc), '##%')))

Also, enable 'Show Partial Sums' for State dimension from presentation tab

Not applicable
Author

Sunny, Thanks for your quick response.

Just now I tried as you suggested.

Created Inline tables with dim1(1,2) and another table dim2(1,2,3,4)

Now I have taken my dimensions as

state, and in calculated dimension

=Pick(Dim1, Role, 'Total')

=Pick(Dim2, 'hc', 'act', 'gap', '%')

and Expression

=Pick(Dim2, Sum(hc), Sum(act), Sum(gap), If(Dim1 = 2, Num(Sum(act)/Sum(hc), '##%')))


Then why am not getting results as same like you.Please suggest where did am wrong.


Pls help!

sunny_talwar

What are you getting? May be check 'Always Fully Expanded' on the presentation tab

Not applicable
Author

Hey Sunny thank you so much for your solution really its working great now.!!!

Thanks again!!!