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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
konHi
Partner - Contributor III
Partner - Contributor III

Join / Merge actual and target values

Hi,

i have the following problem and don't see the solution how to solve it (tried a lot of things but still don't get it).

I have two tables:

1: actual sales

2: targets

Actual Sales:

RowNr.Dep.Main. DepAreaPlantModellSales

1

A

BBCDE1

-

5
2ABBCDF1-5
3ABBFDE1-12
4ABBFDE2-5
5BBBFDE--16
6ABC--

Mod1

17

2: Target

RowNr.Dep.Main. DepAreaPlantModellTarget

11

A----12
12ABB---8
13-BB---9
14ABBFDE--13
15----Mod15
16-BC-1-8
17A--1-12

As a result I want to have following in Pivot Table:

RowNr.Dep.Main. DepAreaPlantModellSalesTarget
21A----4412
22ABB---278
23-BB---439
24ABBFDE--1713
25----Mod1175
26-BC-1-08
27A--1-2212
28ABB-1-22-
29-BC--Mod117-

There is no real hierarchy in the structure. I always want to have the sum(Sales) and the Target at the specific level. (RowNr. is only for reference. )

For Example:

Example RowNr:Pivot DimensionsSales ExpressionTarget Expression
22Dep. -> main.Dep: A->BB=sum(Row1+Row2+Row3+Row4) = 27=Target from Row 12 = 8
24Dep. -> main.Dep ->Area: A->BB-FDE=sum(Row3+Row4) = 17=Target from Row 14 = 13
26Main.Dep ->Plant=sum(Not Available) = 0=Target from Row 16 = 8
28Dep. -> Main.Dep. -> plant0sum(Row1+ Row2 + Row3) = 22=Target now available = -

I hope you understand my problem. I am very grateful for you answers. Please find attached the QVW with the data. thank you very much

14 Replies
konHi
Partner - Contributor III
Partner - Contributor III
Author

Thank you, after trying to figure out how to force qlikview to evaluate at row level I am still not getting any progress. I tried to evaluate a dynamic set analysis in an expression. Still not getting what i want (set analysis is evaluated on the chart level too)

The problem should not be that difficult but I don't see the path to solve the problem.

Any other suggestions? I tried to do it with "generic keys", no progress 😞

konHi
Partner - Contributor III
Partner - Contributor III
Author

My new approach was to create two fact tables and in Expression:

=only(if(

  if( vShowDep=1, Dep.=T_Dep., T_Dep. = '')

  and (if( vShowMainDep=1, Main.Dep=T_Main.Dep, T_Main.Dep = ''))

  and (if( vShowArea=1, Area=T_Area, T_Area = ''))

  and (if( VShowModell=1, Modell=T_Modell, T_Modell = ''))

  and (if( vShowPlan=1, Plan=T_Plan, T_Plan = ''))

  , T_Target))

it works, but for the calculation QlikView creates an cartesian product (in the background) very very bad performance. Any idea in tuning this?

Colin-Albert
Partner - Champion
Partner - Champion

I think you need to re-evaluate the data model and the table structure of your data.

Consider concatenating your actuals and target data as initially suggested by mov‌ and others.

konHi
Partner - Contributor III
Partner - Contributor III
Author

Hi Colin, thank you for you answer.

The problem is, a simple concatenation and then sum(Target) does not work, because qlikview sums all targets with Dep = A for example. but it should only show the target where Dep = A and all other fields are empty. If i Want to show Dep. and Main.Dep then only the Target where dep. and Main. Dep has values should be shown.

Colin-Albert
Partner - Champion
Partner - Champion

If your data has a common Dep dimension field  on the actual and target records, then having the Dep as a dimension of your chart will ensure that sum(Target) will show the relevant data for each Dep.

You will need to have relevant dimensions on both the actual and target records.

Ignore the row numbers and analyse your data by the dimensions.