Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
How to show missing total for below image. This is pivot table. I am getting total for only one value and not for all. I wanted to show totals for all the values.
Dim1: =aggr(only({<%Month = {'$(=$(=vPrevMonth))'}, %Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'}>}CRR),PARTY_ID)
Dim2: =aggr(only({<%Month = {'$(=$(=vCurrMonth))'}, %Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CRR),PARTY_ID)
Expression
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') =
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') <
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') >
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
)
)
)
To calculate the total in the pivot table, you will need to use an Aggr() wrapped around the expression. This Aggr() needs the chart dimensions as fields, but you are using calculated dimensions, so you have to use the underlying fields. you could try:
Sum(Aggr(if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') =
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') <
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') >
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
)
)
), CRR, PARTY_ID))
But if I can make a suggestion - do the replace operations in the load script. This will make your expressions much easier to write, understand and debug, and leads to a more sustainable model.
can you post the sample application?
Hi Priya,
Provide a sample .qvw file .
Regards,
Anjali
To calculate the total in the pivot table, you will need to use an Aggr() wrapped around the expression. This Aggr() needs the chart dimensions as fields, but you are using calculated dimensions, so you have to use the underlying fields. you could try:
Sum(Aggr(if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') =
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') <
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
if(
Replace(replace(only({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR','') >
Replace(replace(only({<%Month = {'$(=$(=vPrevMonth))'},%Year = {'$(=$(=vPrevYear))'},CURRENCY = {'$(=$(vCurr))'} >}CRR),'_','.'),'CRR',''),
Count({<%Month = {'$(=$(=vCurrMonth))'},%Year = {'$(=$(=vCurrYear))'},CURRENCY = {'$(=$(vCurr))'}>}CONTRACT) ,
)
)
), CRR, PARTY_ID))
But if I can make a suggestion - do the replace operations in the load script. This will make your expressions much easier to write, understand and debug, and leads to a more sustainable model.
Thanks Jonathan,
It worked like below