Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bnelson111
Creator
Creator

Grouping a 'if' sum expression

Below is a table export with name and order which has a Max date greater than so many days. Then if that criteria is achieved then i have below which is working perfectly. However to speed up reporting i would like it grouped. 

Thank you in advance.

Please see figure 2

 

NameOrderCodesMax DateStock HoldingDollars
42210455229214-Apr-20135,576£1,351.69
42224581895810-Jun-20141,460£1,404.70
32228996013227-Jun-205,000£192.70
32230711795128-Jul-2061,700£2,377.92
32230901805523-Jul-2027,500£1,059.85
62086231982218-Nov-1894,200£410.71

 

Figure 2

NameDollars
4£2,756.39
3£3,630.47
6£410.71

 

The expression is currently 

=if([Max Date]<=Today()-180 and CustName='4' or
[Max Date]<=Today()-120 and CustName='3' or
[Max Date]<=Today()-120 and CustName='2' or
[Max Date]<=Today()-120 and CustName='1' or
[Max Date]<=Today()-120 and CustName='5' or
[Max Date]<=Today()-90 and CustName<>'5'and CustName<> '4'and CustName<>'3'and CustName<>'2'and CustName<>'1'

,((sum(InventoryQty)*UnitPrice)/PriceUnitConv))

 

((sum(InventoryQty)*UnitPrice)/PriceUnitConv)) = Dollars is a expression

CustName = Name currently a Dimension

Also Codes is in Dimension. 

 

Thanks in advance

Labels (5)
3 Replies
edwin
Master II
Master II

do you have sample data that shows unit price and price conv?  these should be related to products and not orders rt?  do these numbers change over time?  are they per order?  are Codes your product?

bnelson111
Creator
Creator
Author

Unit price is related to the Codes as well as the unit price, however the orders are dated. The table is to show all order that are over a certain date by Name then value. This is working 100% but i wish then to simplify and sum that name with orders of a date as a over all total, i think the code and date is stopping it.😕

bnelson111
Creator
Creator
Author

Got it 🙂

 

=sum(aggr((

if([Max Date]<=Today()-180 and CustName='4' or
[Max Date]<=Today()-120 and CustName='3' or
[Max Date]<=Today()-120 and CustName='2' or
[Max Date]<=Today()-120 and CustName='1' or
[Max Date]<=Today()-120 and CustName='5' or
[Max Date]<=Today()-90 and CustName<>'5'and CustName<> '4'and CustName<>'3'and CustName<>'2'and CustName<>'1'

,sum((InventoryQty)*UnitPrice)/PriceUnitConv)),Codes))