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

Aggregate function with Set Analysis not working

@
Hi,

I've recently been tasked with an exercise to calculate the number of Active customers within SAP.

I've managed to pull the total amount outstanding by writing the following code and it all works perfectly :

 

 

=

num(sum({<Event = {'Due Date'},Cleared_Flag =,[Posting Date] = {"<=$(vDates)"}, Month=, Year=>}if([Clearing Date] >$(vDates),

[Amount in LC_DMBTR],

if(

IsNull(

[Clearing Date])=-1,

[Amount in LC_DMBTR],

if(

len(

[Clearing Date])<4,

[Amount in LC_DMBTR])))),'# ##0')



Where vDates is a variable that contains the selected date.

I then tried to find the number of active customers by taking the above mentioned formula and adding in an aggregate function by Customer, the result should've had been 1000, however i'm returning a value of 848, kindly assist.

Below is my my formula to compute the active customers but it is not seemingly working properly:

 

=

sum(aggr(if(sum({<Event = {'Due Date'},Cleared_Flag =,[Posting Date] = {"<=$(vDates)"}, Month=, Year=>}(if([Clearing Date] >$(vDates),

[Amount in LC_DMBTR],

if(

IsNull(

[Clearing Date])=-1,

[Amount in LC_DMBTR],

if(

len(

[Clearing Date])<4,

[Amount in LC_DMBTR])))))<>0,1),

Customer))

0 Replies