Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
kwl1234
Partner - Contributor III
Partner - Contributor III

Problem on total percent

I got a problem on the total % of the table.

The % on each row is calculated correctly but there are problem on total percent.

Here is my expression

(IF((DATE(Date#(WORKDATE, 'YYYYMMDD'), 'YYYYMMDD') <= DATE(MonthEnd(Date#("YEAR"&"MONTH", 'YYYYMM')), 'YYYYMMDD')),
(((RangeMax(((Sum(CU) + (SUM(PA) * -1))/1000), (((Sum(PP) / 1000 ) + (SUM(PP_RECEIVED) / 1000)) * -1)))
- ((SUM(BOOKOUT) - SUM(OUTSTAND))/1000 * -1))
/
(RangeMax(((Sum(CU) + (SUM(PA) * -1))/1000), (((Sum(PP) / 1000 ) + (SUM(PP_RECEIVED) / 1000)) * -1)))),
(((SUM(GP)/(SUM(COST) + SUM(GP))) - IF(len(trim([D]))=0,0,[D])))))

 

and my table dimension was restricted with expression

=IF((FISCAL_YEAR & FISCAL_MONTH &'31'<WORKSTART),Null(),ORDER)

 

I tried add the sum and aggr on the percentage calculation, but it only sum all the percentage.

 

 

1 Reply
rubenmarin

Hi, I don't know about the first if, but each RangeMax (or the entire part of the division) might be in it's own aggr to calculate row by row,like:

Sum(Aggr((((RangeMax(((Sum(CU) + (SUM(PA) * -1))/1000), (((Sum(PP) / 1000 ) + (SUM(PP_RECEIVED) / 1000)) * -1)))
- ((SUM(BOOKOUT) - SUM(OUTSTAND))/1000 * -1)), DimensionField)

/Sum(Aggr((RangeMax(((Sum(CU) + (SUM(PA) * -1))/1000), (((Sum(PP) / 1000 ) + (SUM(PP_RECEIVED) / 1000)) * -1)))),
(((SUM(GP)/(SUM(COST) + SUM(GP))) - IF(len(trim([D]))=0,0,[D]))))), DimensonField)

just a test and a sample of what you can try, I didn't care to pick the correct parenthesys.

You can also split the diffferent operatos of the expression in diffrent expression and debug them one by one until you get the correct final expression.