ChristineRTP
New Member
- Joined
- Oct 29, 2009
- Messages
- 12
This is the current Power Query code: With the data coming from another Power Query table (tblDateCurrent) with only one entry.
let
Source = Teradata.Database("cdwp", [HierarchicalNavigation=true, Query="SELECT #(lf) DIV_DESC,#(lf) DEPT_DESC,#(lf) SUB_DEPT_DESC,#(lf) COST_CNTR_NBR,#(lf) COST_CNTR_NM,#(lf) VERS_NM,#(lf) YEAR_NBR,#(lf) CAL_DT,#(lf) sum(FT_EMP_OR_HEAD_CNT),#(lf) RESRC_CLASS,#(lf) CAT_NM,#(lf) REPORT_DATE#(lf)FROM ENTR_OPRT_EXPNS_RPT.ACTL_BDGT_FRCST_FTEMP_HC_D#(lf)where report_date = [FONT=arial black](tblDateCurrent)[/FONT]#(lf)and div_desc = 'BCBS-Comm & Gov Services Ops'#(lf)group by 1,2,3,4,5,6,7,8,10,11,12#(lf)order by 1,2,4,10,11,12#(lf)"]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"REPORT_DATE", type date}, {"CAL_DT", type date}}),
#"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"CAL_DT", each Date.MonthName(_), type text}}),
#"Split Column by Position" = Table.SplitColumn(#"Extracted Month Name", "CAL_DT", Splitter.SplitTextByPositions({0, 3}, false), {"CAL_DT.1", "CAL_DT.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"CAL_DT.1", type text}, {"CAL_DT.2", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"CAL_DT.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"CAL_DT.1", "Month"}})
in
#"Renamed Columns"
The TetaData code that results is below:
SELECT
DIV_DESC,
DEPT_DESC,
SUB_DEPT_DESC,
COST_CNTR_NBR,
COST_CNTR_NM,
VERS_NM,
YEAR_NBR,
CAL_DT,
sum(FT_EMP_OR_HEAD_CNT),
RESRC_CLASS,
CAT_NM,
REPORT_DATE
FROM ENTR_OPRT_EXPNS_RPT.ACTL_BDGT_FRCST_FTEMP_HC_D
where report_date = (tblDateCurrent)
and div_desc = 'BCBS-Comm & Gov Services Ops'
group by 1,2,3,4,5,6,7,8,10,11,12
order by 1,2,4,10,11,12
I want the teradata code to have the current data that is in the Power Query (tblDateCurrent). Any help with be greatly appreciated.
ChristineRTP
let
Source = Teradata.Database("cdwp", [HierarchicalNavigation=true, Query="SELECT #(lf) DIV_DESC,#(lf) DEPT_DESC,#(lf) SUB_DEPT_DESC,#(lf) COST_CNTR_NBR,#(lf) COST_CNTR_NM,#(lf) VERS_NM,#(lf) YEAR_NBR,#(lf) CAL_DT,#(lf) sum(FT_EMP_OR_HEAD_CNT),#(lf) RESRC_CLASS,#(lf) CAT_NM,#(lf) REPORT_DATE#(lf)FROM ENTR_OPRT_EXPNS_RPT.ACTL_BDGT_FRCST_FTEMP_HC_D#(lf)where report_date = [FONT=arial black](tblDateCurrent)[/FONT]#(lf)and div_desc = 'BCBS-Comm & Gov Services Ops'#(lf)group by 1,2,3,4,5,6,7,8,10,11,12#(lf)order by 1,2,4,10,11,12#(lf)"]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"REPORT_DATE", type date}, {"CAL_DT", type date}}),
#"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"CAL_DT", each Date.MonthName(_), type text}}),
#"Split Column by Position" = Table.SplitColumn(#"Extracted Month Name", "CAL_DT", Splitter.SplitTextByPositions({0, 3}, false), {"CAL_DT.1", "CAL_DT.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"CAL_DT.1", type text}, {"CAL_DT.2", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"CAL_DT.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"CAL_DT.1", "Month"}})
in
#"Renamed Columns"
The TetaData code that results is below:
SELECT
DIV_DESC,
DEPT_DESC,
SUB_DEPT_DESC,
COST_CNTR_NBR,
COST_CNTR_NM,
VERS_NM,
YEAR_NBR,
CAL_DT,
sum(FT_EMP_OR_HEAD_CNT),
RESRC_CLASS,
CAT_NM,
REPORT_DATE
FROM ENTR_OPRT_EXPNS_RPT.ACTL_BDGT_FRCST_FTEMP_HC_D
where report_date = (tblDateCurrent)
and div_desc = 'BCBS-Comm & Gov Services Ops'
group by 1,2,3,4,5,6,7,8,10,11,12
order by 1,2,4,10,11,12
I want the teradata code to have the current data that is in the Power Query (tblDateCurrent). Any help with be greatly appreciated.
ChristineRTP