2014年4月1日 星期二

And-Mode:How to find your customer 原來QlikView 不是只有綠色 也有紅色


QlikView 本身有綠白灰三個顏色,分別代表是"選擇,答案及非關連"
其實,QlikView 也有紅色的耶


上圖的例子綠色表示And 紅色表示Not ;
意境是 : 找出我的客戶群中有買Atles Lussekofta , Basket Shoes 產品,但是沒有買 Cap的客戶是誰? 

建立一個table ,串接資料將客戶對應多筆產品的資料組成一個新表格
andModeJoin:
Load CustomerID, Customer Resident Customers;
Join (andModeJoin)LOAD OrderID, CustomerID Resident Order_Header;
Join (andModeJoin)LOAD ProductID, OrderID Resident Order_Details;
Join (andModeJoin)LOAD ProductID, ProductName Resident Products;

這表格的長像如下:
customer01 product1
customer01 product2
customer02 product1....

這是直接應用在同一個欄位上的方式,其實QV也有另種方式,是利用Alternate 方式來讓前台人可以分析兩個相同欄位,但是用Alternate 沒有And 的關係他是OR 的方式;
意境是 : 找出我的客戶群中有買Atles Lussekofta 或是 Basket Shoes 產品的客戶中,但是沒有買 Cap的特定客戶是誰?

命名一個Excluding  Alternate : 在document 屬性設定>一般 > Alternate
建立一個Chart , 其運算式為
sum({$<ProductName = p({$} ProductName) - p({[Excluding]} ProductName)>} UnitPrice)