2016-02-26 43 views
1

我正在使用pentaho壺5.2.0版本。我試圖做我的源數據轉點,這裏是我的源結構在Pentaho壺中應用樞軸

Billingid sku_id qty 
    1   0  1 
    1   0  12 
    1   0  6 
    1   0  1 
    1   0  2 
    1   57  2 
    1   1430  1 
    1   2730  1 
    2   3883  2 
    2   1456  1 
    2   571  9 
    2   9801  5 
    2   1010  1 

而這正是我期待

billingid 0 57 1430 2730 3883 1456 571 9801 1010 
    1    *******sum of qty****** 
    2 

this is the steps which I did in row denormaliser, but unable to get expected output

任何幫助非常感謝..提前預約

+0

你只是想計算數量公關。 BILLINGID? – bolav

+0

沒有@bolav,我試着總結數字對billingid vs sku_id。我想要對列列表billingid和sku_id – Deepesh

+0

的數量總和你可以做一個格式,你得到一個行billingid和sku_id組合是唯一的,你得到billingid,sku_id,sum_qty,或者你必須非規範化? (第一個選擇更容易製作) – bolav

回答

1

對於denormaliser工作,你首先必須排序,並組的行,有sum of qty。因此,轉變將是這個樣子:

排序上billingidsku_id,然後sumqty,組由billingidsku_id

screenshot of group by

然後在denomaliser您需要列出每個不同的sku_id,以製作一個列pr pr .:

screenshot of denomaliser

這將給預期輸出:

screenshot of expected output

+0

這太棒了!它真的讓我的一天:)非常感謝。我現在唯一擔心的是,如果「sku_id」列中的記錄數增加,那麼在denormaliser步驟的Key值列中手動寫入所有值將是非常繁瑣的任務。對此有何建議? – Deepesh

+1

@Deepesh:您可以使用[ETL元數據注入](http://wiki.pentaho.com/display/EAI/ETL+Metadata+Injection)。 – bolav

+0

我一定會嘗試這一步。再次感謝:) @bolav – Deepesh