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

same expression in two different charts but getting totals different

Hello All,

              kindly suggest me what i am missing in my expression please

i have a straight table chart with

                                           3-   Dimensions: p_Material

                                                                   VENDOR CODE

                                                                   CATEGORY DESCRIPTION1

                                             1- Expression:

  sum(aggr(Avg({<BVALIDFROM={"<$(=Date(yearstart(today(),0,4),'DD-MM-YYYY'))"},BVALIDTO={">$(=Date(yearstart(today(),0,4),'DD-MM-YYYY'))"}>}distinct BPrice)*sum(VOLUME),p_Material,[VENDOR CODE]))

what i am doing is avg  of BPrice * sum of Volume  group by p_Material,Vendor code.......

Capture1.PNG

the  Total i am getting is :33478046

when i tried to implement the same in bar chart with

                                              1- Dimension :  CATEGORY DESCRIPTION1



                                               1- Expression(Same):

  sum(aggr(Avg({<BVALIDFROM={"<$(=Date(yearstart(today(),0,4),'DD-MM-YYYY'))"},BVALIDTO={">$(=Date(yearstart(today(),0,4),'DD-MM-YYYY'))"}>}distinct BPrice)*sum(VOLUME),p_Material,[VENDOR CODE]))

                                             

Capture.PNG

then Total i am getting is :3470522589.32


Even thought i am using the same expression and same dimension i am getting two different total .Is that because of aggregation?


2 Replies
swuehl
MVP
MVP

naveen kumar wrote:

                       


Even thought i am using the same expression and same dimension i am getting two different total .Is that because of aggregation?


You are not using the same chart dimensions.

Note that in first case, your chart dimensions are probably more granular than the aggr() dimensions, so you are running into

Pitfalls of the Aggr function

(DISTINCTNESS of aggr() returned values)

kunkumnaveen
Specialist
Specialist
Author

Hello Stefan, thanks for your quick reply,

Do I need to change the way I had return my expression....sorry I in this qlik only from last 7 months