Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikuser222
Creator
Creator

Help with sum() with filters??

Hi All,

I have a requirement where i need to sum() and its Discount with the date and amount filters. i tried if condition but results are not as expected. Please help me to understand the logical way to do it.

Please find attached which shows the example.

Thanks

17 Replies
sunny_talwar

Hahahaha I think it might be better if OP can clarify... I am just saying what I think he wants . You may very well be right and I am the one who is not right

vamsee
Specialist
Specialist

Haha.. lol lets see.

qlikuser222
Creator
Creator
Author

Thanks stalwar1

Tired interval match but it seem to be not working. Can you please help? please find attcahed !

Thanks

qlikuser222
Creator
Creator
Author

Attached to the original post test (3) (1)

thanks

sunny_talwar

May be this

Main:

LOAD * INLINE [

    ID, Amount, Date

    1, 5, 12/01/2017

    1, 200, 12/02/2017

    1, 150, 12/01/2016

    1, 300, 11/01/2017

    2, 360, 12/12/2017

    2, 399, 12/08/2017

    2, 40, 1/1/2016

];


Filters:

LOAD * INLINE [

    ID, Mindate, MaxDate, MinAmount, Maxamount, Dsic

    1, 01/01/2017, 12/31/2017, 10, 400, 4%

    2, 01/01/2017, 12/31/2017, 10, 100, 4%

    2, 01/01/2017, 12/31/2017, 101, 200, 5%

    2, 01/01/2017, 12/31/2017, 201, 300, 5%

    2, 01/01/2017, 12/31/2017, 301, 400, 11%

];


Left join (Main)

IntervalMatch(Amount, ID)

LOAD Distinct

MinAmount,

Maxamount,

ID

Resident Filters;


Left join (Main)

IntervalMatch(Date, ID)

LOAD Distinct

Mindate,

MaxDate,

ID

Resident Filters;


Left Join (Main)

LOAD *

Resident Filters;


DROP Table Filters;


Capture.PNG

qlikuser222
Creator
Creator
Author

Thanks stalwar1

But now in the attached capture, i am getting 8 instead of 8.2

Sorry for the confusion.

Thanks

sunny_talwar

In that case, I don't think you should do this in the script...

qlikuser222
Creator
Creator
Author

Thanks Sunny,

is there any way possible if when user select ID and dates, Qlik triggers select the MinAmount  and Maxamounts based on the sum(values).