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: 
kunkumnaveen
Specialist
Specialist

how to write this exp

HI All,

How to write this expression,

week          quantity        tm

week1           100             10

week1             200             20

week1              50               5

week2          800               80

week2             120            20

week2            500              5 5

if i select week1 from week i should get this=

                                                     100*10+200*20+50*5

                                                      -------------------------------

                                                            100+200+50

if i select week2 from week i should get this=

                                                         800*80+120*20+500*55

                                                        --------------------------------------

                                                               800+120+500


a dynamic exp which should change with selection


thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Sum(quantity*tm)/Sum(quantity)

Update: I hope that you are using this in a text box object, right?

If you are not, then may be this:

Sum(TOTAL quantity*tm)/Sum(TOTAL quantity)

or

Sum(TOTAL <week> quantity*tm)/Sum(TOTAL <week> quantity)

View solution in original post

2 Replies
sunny_talwar

May be this:

Sum(quantity*tm)/Sum(quantity)

Update: I hope that you are using this in a text box object, right?

If you are not, then may be this:

Sum(TOTAL quantity*tm)/Sum(TOTAL quantity)

or

Sum(TOTAL <week> quantity*tm)/Sum(TOTAL <week> quantity)

kunkumnaveen
Specialist
Specialist
Author

i tried in textbox ,its working actually i need this exp for one of my bar chart ....i will try the two other exp

can u say wats the diff b/w these exp...

Sum(TOTAL quantity*tm)/Sum(TOTAL quantity)

or

Sum(TOTAL <week> quantity*tm)/Sum(TOTAL <week> quantity)


what actually this does <week>