Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
philgood34
Creator II
Creator II

COMPLEX AVERAGE

Hi everyboy

my challenge today :

I have these table (productivity analysis) with    VHT = CATTC / HEURESTABLE.png

I made TOTAL weighted average for VHT like this (thank's Sunny Talwar !) :

If(Dimensionality() = 0, Sum(VMS_CATTC)/Sum(Aggr(Sum(VMS_CATTC)/Sum(CIB_VHT), NCL_LIB)), Sum(CIB_VHT))

Correct !

Now is my issue :

i reload my table with some sectors who do'nt produce CATTC but with a productivity calculated with CATTC TOTAL

it does not match here :-((TABLE2.png

So i want HEURES  to be calculated by 117127322/VHT if VHT <>0 , else HEURES will be calculated by CATTC/VHT

Obviously if VHT = 0, i don't want any calcul ... (to avoid DIV/0)

Crazy isn't it ?

Hope anyone 'll unterstand my issue

regards

1 Solution

Accepted Solutions
sunny_talwar

Awesome, please close the thread by marking correct and helpful responses.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

View solution in original post

20 Replies
sunny_talwar

What is this number here? 117127322

Is that a constant or is that coming from a calculation?

philgood34
Creator II
Creator II
Author

it'is the sum of the CATTC  (here the sum of selectionned sectors beauté santé, liquides, epicerie , entretien) : totaux.png

sunny_talwar

So based on your screenshot above, what are the expected value for the HEURES column?

philgood34
Creator II
Creator II
Author

398105 expected

excel1.png

here is the workbook

sunny_talwar

May be like this

Sum(Aggr(If(Sum(VMS_CATTC) = 0, Sum(TOTAL VMS_CATTC)/Sum(VHT), Sum(VMS_CATTC)/Sum(VHT)), NCL_LIB))

philgood34
Creator II
Creator II
Author

SO GOOD !  let me try to the total vht ..

thank's a lot again !

see you master

totaux2.png

sunny_talwar

let me try to the total vht ..

Not sure I understand this?

philgood34
Creator II
Creator II
Author

failed !

i tried this for the VHT TOTAL

If(Dimensionality() = 0, Sum(VMS_CATTC)/Sum(Aggr(If(Sum(VMS_CATTC) = 0, Sum(TOTAL VMS_CATTC)/Sum(CIB_VHT), Sum(VMS_CATTC)/Sum(CIB_VHT)), NCL_LIB))), Sum(CIB_VHT))

but i got error message "garbage after expression

a idea ?

sunny_talwar

I am not sure I follow.... What are you trying to do?