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

Aggregate lowest cost for types over dates

Hi all, thanks for any help offered. I have hit a wall and can't figure out what I need to do, I have tried many different things but haven't progressed.

I wish to present by date the sum of the lowest contract cost for excluded ContractTypes.

The following returns me a single lowest contract cost but not the sum by ContractType.

sum(

          aggr(

                    FirstSortedValue(

                      {$<

                        ContractType=e(ContractType)

                        ,Usage_Flag={2}

                      >}

                              ContractCost,ContractCost*RowNoCtr)

          ,Date)

)

The expression needs to only look at usage flag 2 records in the excluded contract types set.

If possible I also need to be able to identify within the usage flag 2 set the following:

If Primary is the ContractType then Primary must also be the Alternate Contract Type.

If Ancillary is the ContractType then Ancillary must also be the Alternate Contract Type.

If OffContract is the ContractType then Primary or Ancillary for the Alternate Contract Type.

----------------------------

The attached example is a very simple model, modified from an application I originally got from this site. The real application will be over month year and include some variation of this solution. If someone could take a peek at the attached document and help me out that would be amazing! Again thanks for any help I can get.

10 Replies
jeremy_fourman
Creator
Creator
Author

Thanks Anders, I understand the differences between them and use selection modifiers field= all the time to clear selections. I was more questioning why using {1} allows the aggr function to work with the e() element function.

Either way, it works and I greatly appreciate your help!