Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average Income Calculation for max-month

Hi,

When trying to calculate Average Income for the YTD period, I use this and it works, but

sum({$<Year={ $(=max(Year)) }>} Commission_Amount)+Sum ({$<Year={ $(=max(Year)) }>} PIP_Profit_or_Loss)) / sum({$<Year={ $(=max(Year)) }>} Volume)

but when I try to do the same calculation for the max month , it does not work. This is how I am doing it

  =sum({<MonthNumber= {$(=max(MonthNumber))},Month= ,[Month-Year]=>}Commission_Amount)+ sum({<MonthNumber= {$(=max(MonthNumber))},Month= ,

[Month-Year]=>}PIP_Profit_or_Loss )/sum({<MonthNumber= {$(=max(MonthNumber))},Month= ,[Month-Year]=>}Volume)

Please help me.

Yolanda

Labels (1)
9 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Please post a qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
Not applicable
Author

Please find attached

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Can you tell me what's not working? I'm afraid I don't understand what result you want to see where.


talk is cheap, supply exceeds demand
Not applicable
Author

I want the month calculation to work like the YTD Calc so I can calculate income for the YTD period and for the current month period.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

As far as I can see that's exactly what the expression do. I don't see any wrong results.


talk is cheap, supply exceeds demand
Not applicable
Author

Yeah, Its works when I split it up (Income and Volume) but just does not give the right answer when I put it together (Income/Volume).

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Make sure to put the parentheses in the right places. a+b/c is not the same as (a+b)/c.


talk is cheap, supply exceeds demand
Not applicable
Author

That is also not working, gives me 0.

Do you think anything else needs to be done?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I have no idea because I don't see any problem. It works fine for me. See attached qvw.


talk is cheap, supply exceeds demand