Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikfun
Contributor
Contributor

YTD accumulation for 2 dimensions, multiple values for second dim - set analysis

Hi all,

I'm trying to create an expression, which calculates the YTD accumulation, but for sub products of the first one per Month-Year.

It works fine if I have just 1 product, per Month Year. ie. The accumulation works as expected and the calc for this is:

=rangesum(above(Total sum({<[Sales Date]={">=$(vStartCurrYr)<=$(vCurrYrEndDate)"},[Sales Date1]= {">=$(vYTDYEAR) <=$(vYTDDate)"}, PeriodFY_Month_Name>} Measure)
,0,rowno(TOTAL)) )

1pROD_YTD_Qlik_Works.PNGBut when I add in a Sub Product, next to Product, it doesn't accumulate per Sub Product. It appears that it is accumulating all the values for the Sub Products together, like the following:

In this case, there are 2 Sub Product per Product, but it doesn't accumulate correctly per Sub Product.

sub product_wrong ytd.PNG

 Any ideas on how to accumulate the values per Sub Product per Month Year?

 

Much appreciated.

 

Labels (5)
2 Replies
tresesco
MVP
MVP

Could you share your sample app?
sunny_talwar

May be try this

=Aggr(RangeSum(Above(Sum({<[Sales Date] = {">=$(vStartCurrYr)<=$(vCurrYrEndDate)"}, [Sales Date1] = {">=$(vYTDYEAR) <=$(vYTDDate)"}, PeriodFY_Month_Name>} Measure)
, 0, RowNo())), Product, Sub-Product, ([Month Year], (NUMERIC)))