Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
slribeiro
Partner - Creator
Partner - Creator

Values aggregation

Imagine I have the following data set

TABLE1
Dim1Dim2Dim3Dim4Value1Value2
Name1Country1City1-100-
Name2Country2City2-200-
Name3Country2City3-300-
Name4Country3City4-400-
---Country1-300
---Country2-200
---Country3-500

How can I aggregate this data set in order to be able to build the following pivot table (I don't mind to use set analysis). Any solution it works to me.

 

PIVOT
Dim1Dim2Value1Value2
Name1Country1100300
Name2Country2200200
Name3Country2300200
Name4Country3400500

Please help me, I'm really stucked.

Thanks in advance

4 Replies
sunny_talwar

This is all in one table?

Or
MVP
MVP

Nothing in your data structure suggests there's a relation between the fifth row (Country1 / 300) and the first row, or any other set of rows. Since you have not specified what the relationship is, I am going to assume that the relationship is based on Dim2 = Dim4. If that is the case, the most logical approach at the script level is:

1) Create a mapping table based on Dim1 and Dim2 (Load Distinct Dim1, Dim2)

2) Fill in Dim2 where it is missing (get the value from Dim4)

3) Lookup the appropriate Dim1 from your lookup table and fill it in

I would strongly advise against trying to solve this problem at the chart dimension level. That's not the right spot to fix your data structure.

stigchel
Partner - Master
Partner - Master

I would advice to change this in your load script something like:

Tmp:

LOAD Dim1,

     Dim2,

     Dim3,

     Dim4,

     Value1,

     Value2

FROM

[https://community.qlik.com/thread/230404]

(html, codepage is 1252, embedded labels, table is @1, filters(

Remove(Row, Pos(Top, 1))

));

NoConcatenate Load Dim1,Dim2,Dim3,Value1 resident Tmp where Len(Dim1)>0;

Join Load Dim4 As Dim2, Value2 resident Tmp where Len(Dim4)>0;

Drop Table Tmp;

stigchel
Partner - Master
Partner - Master

And the document attached