Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
Specialist
Specialist

how to write dynamic expression for weighted avg

HI

sample data:

place        ship     quantity       tm

loadport  ship1      1000           9.2

loadport  ship1      1200           9.8

loadport  ship1      1030           7.2

loadport  ship2    2000              1.5

loadport  ship2     1100           1.9

loadport  ship2    3000        9.2



required out put in straight table:

             place       ship           quantity                                tm

                                              sum(quantity)                      ?(how to write this dynamic expression)

             loadport    ship1            3230                                1000*9.2+1200*9.8+1030*7.2/1000+12000+1030

            loadport       ship2            6100                               2000*1.5+1100*1.9+3000*9.2/2000+1100+3000

thanks

                                      



16 Replies
kunkumnaveen
Specialist
Specialist
Author

it need to consider both dimension 

      place and ship(usi)

avinashelite

then remove the aggr its not required by default qlikview will consider both the dimension for the expression calculation 

brijesh1991
Partner - Specialist
Partner - Specialist

sum( quantity * tm)/sum( total quantity )

kunkumnaveen
Specialist
Specialist
Author

i was trying to hide and sho w the expression but its not working ,can u help me please

i set variable in the textbox:vSelect=1

same i wrote under expression

in condition box:    vSelect=1

so it mean when ever i click textbox then only this expression has to show ...if i click

Clear ALL button then it should hide .......only dimensions has to be shown

but its not happening in my case ..........can u say y

kunkumnaveen
Specialist
Specialist
Author

i was trying to hide and show the expression but its not working ,can u help me please

i set variable in the textbox:vSelect=1

same i wrote under expression

in condition box:    vSelect=1

so it mean when ever i click textbox then only this expression has to show ...if i click

Clear ALL button then it should hide .......only dimensions has to be shown

but its not happening in my case ..........can u say y

avinashelite

clear button will not clear the variable value you need to set it ...

If you want to hide the expression in clear than add a button manually and add action to clear selection and one more action to set the vSelect=0

Anonymous
Not applicable

sum( quantity * tm)/sum( total quantity )