Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Choosing Max Month and YTD

My Data:

Customer NameMonthYearCummPerc CubeCommission
A0120120.751000
A0220120.802000
A0320120.853000
B0120120.80250
B0220120.85500
B0320120.90750
A0120130.652000
A0220130.754000
A0320130.956000
B0120130.801000
B0220130.852000
B0320130.903000

I need an expression where the user selects a Year and a Month and a percent (based on a Variable) and it returns the sum of all commission for that year and all months <= Month selected,  IF the total commission IF "CummPerc Cube" is <= the variable selected.

So for example if the user selects Year: 2012, Month: 02 and the Variable of .82 the the returned object would be:

Customer NameCummPerc CubeCommission
A0.803000

because Customer A is the only one that had "CummPerc Cube" value of under .82 in the month/year that was selected.

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

There's probably a better way but this seems to work:

Sum({1<Month={"<=$(=Max(Month))"},Year=P(),[CummPerc Cube]={"<=$(=vCommission)"},[Customer Name] = P({$<[CummPerc Cube]={"<=$(=vCommission)"}>})>} Commission)

See attached.

Hope this helps,

Jason

View solution in original post

5 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

There's probably a better way but this seems to work:

Sum({1<Month={"<=$(=Max(Month))"},Year=P(),[CummPerc Cube]={"<=$(=vCommission)"},[Customer Name] = P({$<[CummPerc Cube]={"<=$(=vCommission)"}>})>} Commission)

See attached.

Hope this helps,

Jason

zagzebski
Creator
Creator
Author

Jason -

Awesome! I think this will work great. Thanks

Steve

Jason_Michaelides
Luminary Alumni
Luminary Alumni

You may want to remove the '1' at the start of the set analysis to keep other selections you may have.

zagzebski
Creator
Creator
Author

Jason -

Any ideas on why it seems to only sum on the month I select...not all months <= the month selected.

Steve

Jason_Michaelides
Luminary Alumni
Luminary Alumni

I think it worked OK for me.  Can you post your application that isn't working?