Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

9 Replies
Gysbert_Wassenaar

Please post a qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
Not applicable
Author

Please find attached

Gysbert_Wassenaar

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

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

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

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