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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rolasyeow
Contributor
Contributor

How to retrieve the data by using 2 variables calculation including the year and month?

Hi guys, sorry I'm new to Qlik Sense, the calculations I wanted is sum([Local Profit])/sum([Local SubTotal]) but I also wanted to filter it by selecting specific year and month... 

Therefore, can someone teach me how to correct this expression? I keep getting nested aggregation error message. Below is my expression ...
sum ({<Year={$(=max(Year))},Month= {"=$(=max({<Year={$(=max(Year))}>} Month))"}>} sum([Local Profit])/sum([Local SubTotal]))

Labels (1)
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

It should be 

sum ({<Year={$(=max(Year))},Month= {"=$(=max({<Year={$(=max(Year))}>} Month))"}>} [Local Profit])

/

sum({<Year={$(=max(Year))},Month= {"=$(=max({<Year={$(=max(Year))}>} Month))"}>}[Local SubTotal])

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

It should be 

sum ({<Year={$(=max(Year))},Month= {"=$(=max({<Year={$(=max(Year))}>} Month))"}>} [Local Profit])

/

sum({<Year={$(=max(Year))},Month= {"=$(=max({<Year={$(=max(Year))}>} Month))"}>}[Local SubTotal])

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!