Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
etiennesan
Contributor III
Contributor III

Changing formula depending on whether the association exists or not

Hello everyone,

Here is my problem: I have a table for invoices (one line = one shipment with its fare), and then I have one table with the detail of what was sent in this shipment, that I'm using to know  for each product in this shipment, how much of the total weight (and therefore total fare) it amounted for.

However, I dont have this detail for every invoice, so in some cases I should just use the main fare as is.

I am trying to do a pivot table with those two formulas, but none of them works.

SUM(If(WeightRatio, WeightRatio * TotalFare, TotalFare))
If(WeightRatio, SUM(WeightRatio * TotalFare), SUM(TotalFare))

 How to use the WeightRatio * Total fare when I can find my product in the detailed table (meaning it has a WeightRatio value associated with it), and use TotalFare when I cannot?

Thank you very much!

Etienne

2 Replies
Saravanan_Desingh

Try this

SUM(If(Not IsNull(WeightRatio), WeightRatio * TotalFare, TotalFare))
etiennesan
Contributor III
Contributor III
Author

Thank you for your reply. I just tried it, but the end result is the same as if I just put  

Sum(WeightRatio * TotalFare)