Set Analysis indipendent of pivot table's dimension
Hi!
I am having some difficult time with set analysis.
I have two tables linked with "Customer" field defined inside the script.
I have a pivot table with a dimension “Trader” and I need to calculate the ratio between the count of the number of orders (ID) of a specific type (TYPE) made by a trader and the total number of orders regardless of its type.
If the trader does not have order of a specific type, I want to calculate the ratio between the Customer Area's number of orders related to this trader for all the type and the total number of orders. But the trader could have two or more different Customer Area.
I think that if I understand the set analysis to calculate the numerator, I can easy calculate the denominator. So, in the attached example, I calculate only the numerator.
The expression is like this:
I need to find a set analysis to calculate the 'x' value.
For example, in the attached qvw, the trader ‘5’ does not have type ‘2’ orders. So I focus on his Customer Areas, that is 'Oil' and 'Banking', and I want the count of the distinct orders with type ‘2’ in these two areas independently of the trader, therefore 22.
I know that a trader can have, for example, 3 orders with type 1 and 2 orders with type 3, in two different customer area (4 in Banking and 1 in Oil), but, at present, it is not important to calculate a weighted average; it might be useful.
If someone has some best practices to improve the expression's performance, it would be very appreciated.
Thank you very much for the support, I hope I was clear.