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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
lain_
Contributor III
Contributor III

Adding Specific Rows in Pivot Table

I have a pivot table like the one below. A-F and N and Y are dimensions. The values in the N and Y columns are calculated by an expression. I was wondering if it is possible to get the ? column where for each row, I divide that value by the sum of the values of the last three rows.

 NY?
A17

cell(A, N) / (cell(D, N)+cell(E, N)+cell(F, N))

B28cell(B, N) / (cell(D, N)+cell(E, N)+cell(F, N))
C39cell(C, N) / (cell(D, N)+cell(E, N)+cell(F, N))
D410cell(D, N) / (cell(D, N)+cell(E, N)+cell(F, N))
E511cell(E, N) / (cell(D, N)+cell(E, N)+cell(F, N))
F612cell(F, N) / (cell(D, N)+cell(E, N)+cell(F, N))

 

2 Solutions

Accepted Solutions
Saravanan_Desingh

One solution is.

tab1:
LOAD RowNo() As RowID, * INLINE [
    D1, N, Y
    A, 1, 7
    B, 2, 8
    C, 3, 9
    D, 4, 10
    E, 5, 11
    F, 6, 12
];

Left Join(tab1)
LOAD Sum(N) As Last3N
Resident tab1
Where RowID >= 4;

tab2:
LOAD *, N/Last3N As Value
Resident tab1;

Drop Table tab1;

View solution in original post

Saravanan_Desingh

Front End solution.

Dimension: D1

Expression: N/$(=Sum(Aggr(If(RowID>=4,N,0),D1)))

commQV76.PNG

View solution in original post

3 Replies
Saravanan_Desingh

One solution is.

tab1:
LOAD RowNo() As RowID, * INLINE [
    D1, N, Y
    A, 1, 7
    B, 2, 8
    C, 3, 9
    D, 4, 10
    E, 5, 11
    F, 6, 12
];

Left Join(tab1)
LOAD Sum(N) As Last3N
Resident tab1
Where RowID >= 4;

tab2:
LOAD *, N/Last3N As Value
Resident tab1;

Drop Table tab1;
Saravanan_Desingh

Output.

commQV75.PNG

Saravanan_Desingh

Front End solution.

Dimension: D1

Expression: N/$(=Sum(Aggr(If(RowID>=4,N,0),D1)))

commQV76.PNG