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: 
Ditshele
Contributor
Contributor

Using the status of the latest month and disregard the previous month's [front end]

Good day,

I am trying to calculate the sum of amount using a current month status ='Active' irrespective of the previous statuses.I tried the below expression and it does not work.Your help will be highly appreciated.

if(match(Only({<Month={$(vMaxMonth)}>}Status),'Active'),Sum(Amount))

 

Ditshele_0-1612890505021.png

I would like to do this on the front-end so that the date changes with the month selection.

5 Replies
edwin
Master II
Master II

look at this post, its the same design pattern:
Max Date per Month - Qlik Community - 1527312

it gets the last value of a specific column.  if you use this you can get the last status per ID just test that:

edwin_0-1612909669117.png

the first expression gets the last status, the 2nd expression tests that status and if active returns the total - effectively disregarding prior statuses.  obviously, you dont need the first expression - added just so you see how it works

 

edwin
Master II
Master II

 

only(Aggr(If(month = Max(TOTAL <ID> month), only(status)), month, ID))

if(only(Aggr(if(month = Max(TOTAL <ID> month), only(status)), month, ID))='Active', sum(amount))

 

 

Ditshele
Contributor
Contributor
Author

Thank you so much for this, but are you able to any values if you just have Region and Amount as columns? I am getting nulls.

edwin
Master II
Master II

how will you be able to include amount as dimension when you are summing it?

if you want region added as a dimension, just add it in all the aggregations:

edwin_0-1612966161310.png

 

edwin
Master II
Master II

edwin_1-1612966288404.png