Sunday, 22 January 2017

Changing The Grain Of Budget Table

//Load Bueget,Percentage And Check the Granulariy 

Budget:

LOAD Budget_ID,
     Employee_ID,
     Deparment,
     Product_ID,
     Name,
     Year,
     Budget_Amount As Q_Budget_Amount
FROM
[C:\Users\Peidu\Desktop\Project\2017-01-21\source_project\Granularity\Budget.txt]
(txt, codepage is 936, embedded labels, delimiter is ',', msq);

Percentage:
Mapping
LOAD Quarter,
     Percentage
FROM
[C:\Users\Peidu\Desktop\Project\2017-01-21\source_project\Granularity\Percent.txt]
(txt, codepage is 936, embedded labels, delimiter is ',', msq);



You can see Budget_Amount is calculated by Year, now we want to make it in Quarter following the ratio in Percentage table. 

//Create Calendar

Calendar:

LOAD Year,
     Quarter
FROM
[C:\Users\Peidu\Desktop\Project\2017-01-21\source_project\Granularity\Calendar.txt]
(txt, codepage is 936, embedded labels, delimiter is ',', msq);

// Left Join Fact Table With Calendar

Left Join(Budget)

Load Year,Quarter Resident Calendar;

//Mapping Percentage And Left Join Budget Table

Left Join(Budget)

Load Budget_ID,
     Employee_ID,
     Deparment,
     Product_ID,
     Name,
     Year,
     Quarter,
     Q_Budget_Amount * ApplyMap('Percentage',Quarter) As Budget_Amount Resident Budget;
   
     Drop Field Q_Budget_Amount;



//Budget_Amount Are Distributed Into Quarter Following Percentage Rate

1 comment:

  1. I feel the presence of Qlik and its related tools is felt at all aspects and hence even this blog post justifies that surely.

    Qlik Rest Api Connection

    ReplyDelete