Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
amber2000
Creator
Creator

Total for pivot table expressions and increase of staffel with 0.05 %

Hi everyone,

I'm struggling with 2 issues:

1)     The total in my pivot table doesn't calculate the average values of all the rows

        f.e.

        I have a zone called Flowthru

        This zone is divided into 3 PBL Zones

       Totals Staffel Flowthru.png

This is the result I want to see for that selection, from #Assignments on I want the average of the values

71408480:22:51191037,33146,76157,9993,82%

I looked at the function Total but I don't know where I can insert it into my expression (which is already complicated)

2) The expression fol Staffel_New needs to be increased for every argument in that expression with 0.05 % and again after many attempts I don't know how to implement this in the expression.

Can somebody help me please?

Kind regards,

Monique

32 Replies
sunny_talwar

Check the variable... does it seem to be working?

amber2000
Creator
Creator
Author

Hi Sunny,

Thank you so mutch, it works great for the dimension [FlowType Description], this is almost what I need.

I also want to include the Dimension [Zone] in the Pick(Wildmatch()) function for the other variables.

Can you show me how in the report please?

Kind regards,

Monique

sunny_talwar

Would you be able to provide an example of what you mean? just so that I can follow.... heading out for a little bit, but will respond as soon as I am back

amber2000
Creator
Creator
Author

Sunny,

The last statement you have added should also be able to use the other variables for Dimension [Aisle Zone Description]

So a combination of the 2 dimensions.

%Variables for dimension AisleZone working.png

Something like this (pseudo code)

* Pick(WildMatch([FlowType Description], 'Pbl Zuivel', 'Pbl Vlees', 'Pbl Traiteur'),

(1+vPblZuivel), (1+vPblVlees), (1+vPblTraiteur)),

[FlowType Description], [$(=GetCurrentField(Group2))]))

and

* Pick(WildMatch([Aisle Zone Description], 'Zuivel gekoeld blok F', 'Zuivel Traiteur gekoeld blok H', 'Zuurwaren/Mosselen', 'Zuivel ongekoeld', 'GRF 4de gamma', 'GRF gekoeld'),

(1+vZVLgek), (1+vTraitGek), (1+vZwMossel),  (1+vZVLong), (1+v4deGamma), (1+vGRFgek)),

[Aisle Zone Description], [$(=GetCurrentField(Group2))]))

This example hopefully gives you a better clue of how it should look like

Example %variables for 2 dimensions.png

I'll wait patiently for your return

Kind regards,

Monique

sunny_talwar

See if now looks like what you want

amber2000
Creator
Creator
Author

Sunny,

You performed magic, it works and it is so easy.

There is only one obstacle that's not calculated correct yet and that's the column %StaffelNew

The last Column is the correct result of (Productivity / % StaffelNew)

      

ProductivityStaffel_New%%Variables% StaffelNewProductivity / %Variables
154,31176,825%185,6687,27%83,11%
134,47129,5915%149,03103,76%90,23%
151,5167,552%170,9090,42%88,65%
146,76157,99 168,53 93,8287,33%
191,3204,420%245,2893,59%77,99%
184,28190,770%190,7796,60%96,60%
18,5452,5810%57,83835,26%32,06%
142,83135,890%135,89105,11%105,11%
129,18108,850%108,85118,68%118,68%
139,33145,630%145,6395,67%95,67%
137,68112,590%112,59122,29%122,28%

The expressions are so complex now that I can't interfere no more, can you assist with the last hurdle please?

I apologize for the amount of time I'm absorbing from you.

Kind regards,

Monique

sunny_talwar

Are you looking to fix this?

Capture.PNG

amber2000
Creator
Creator
Author

Sunny that's the fix I wanted to do. You are my HERO

I've enabled the column and after a complete check I see that it's correct. So sorry for wasting your time.

As everything is working now maybe I can ask you to explane  some of the changes you made and why you've made them.

Especially the statement for the calculation of the avg totals because it's completely different from the original statement:

if([Aisle Zone Description] = 'Zuivel gekoeld blok F'
,#Colli/#Assignments *
pick(match(floor(#Colli/#Assignments),
     $(=concat(ProdStafValue_F, ',', RowNo))), 
   
$(=concat(ProdFactorValue_F, ',', RowNo)))
,

//Else
#Colli/#Assignments * pick(match(floor(#Colli/#Assignments), 

$(=concat(ProdStafValue_GRF, ',', RowNo))),

$(=concat(ProdFactorValue_GRF, ',', RowNo)))

)

Changed to:

Avg(Aggr(if([Aisle Zone Description] = 'Zuivel gekoeld blok F'

  ,sum({$<[Jobcode Flag] = {"Productive"}>}[Assignment Total Colli])/count({$<[Jobcode Flag]= {"Productive"}>} DISTINCT([Assignment ID]))   * pick(match(floor(sum({$<[Jobcode Flag] = {"Productive"}>}[Assignment Total Colli])/count({$<[Jobcode Flag]= {"Productive"}>} DISTINCT([Assignment ID]))  ),

  $(=concat(ProdStafValue_F, ',', RowNo))), 

  $(=concat(ProdFactorValue_F, ',', RowNo)))

  ,

//Else

sum({$<[Jobcode Flag] = {"Productive"}>}[Assignment Total Colli])

  /count({$<[Jobcode Flag]= {"Productive"}>} DISTINCT([Assignment ID]))  

  * pick(match(floor(sum({$<[Jobcode Flag] = {"Productive"}>}[Assignment Total Colli])

  /count({$<[Jobcode Flag]= {"Productive"}>} DISTINCT([Assignment ID]))  ), 

  $(=concat(ProdStafValue_GRF, ',', RowNo))),

  $(=concat(ProdFactorValue_GRF, ',', RowNo)))

), [FlowType Description], [$(=GetCurrentField(Group2))]))

Kind regards,

Monique

sunny_talwar

Check the attached

Capture.PNG

amber2000
Creator
Creator
Author

I'm confused, where should I look in the report?