Forum Discussion

dixon1983's avatar
dixon1983
Regular Visitor
8 years ago
Solved

Apply a Filter to Data during Import from Teradata DB

Hi,

I wonder if someone can help.

 

I have created a connection within Power BI to a database located on Teradata.

 

There are over 100M rows of data on the database of which I only want to import a certain amount.

 

The criteria for what I want to import is based on the field LOADDATE of which I only want to import the last 7 days (including today).

 

The advanced editor shows the following - is this where I need to place code to filter what is imported? If so please could someone advise what I need to enter?

 

let
    Source = Teradata.Database("xxx.yyy.COM", [HierarchicalNavigation=true]),
    IQR_ODS_V = Source{[Schema="IQR_ODS_V"]}[Data],
    IQR_ABC_DEF_ALL_F_V1 = IQR_ODS_V{[Name="IQR_ABC_DEF_ALL_F_V"]}[Data]
in
    IQR_ABC_DEF_ALL_F_V1

 

 

Many thanks for any help.

  • Hi dixon1983,

    One way, you can filter date rows using screen operation. Please click the triangle-Date filters->Between as picture1 shown, then click the last 7 day and today in the canlendar shown in picture2

    picture1      picture2

    Or you can use the query statement as follows.

     

    let
        Source = Teradata.Database("xxx.yyy.COM", [HierarchicalNavigation=true]),
        IQR_ODS_V = Source{[Schema="IQR_ODS_V"]}[Data],
        IQR_ABC_DEF_ALL_F_V1 = IQR_ODS_V{[Name="IQR_ABC_DEF_ALL_F_V"]}[Data]
       #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] >= #date(2018, 2, 14) and [Date] <= #date(2018, 2, 21))
    in
        #"Filtered Rows"


    Best Regards,
    Angelia

1 Reply

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi dixon1983,

    One way, you can filter date rows using screen operation. Please click the triangle-Date filters->Between as picture1 shown, then click the last 7 day and today in the canlendar shown in picture2

    picture1      picture2

    Or you can use the query statement as follows.

     

    let
        Source = Teradata.Database("xxx.yyy.COM", [HierarchicalNavigation=true]),
        IQR_ODS_V = Source{[Schema="IQR_ODS_V"]}[Data],
        IQR_ABC_DEF_ALL_F_V1 = IQR_ODS_V{[Name="IQR_ABC_DEF_ALL_F_V"]}[Data]
       #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] >= #date(2018, 2, 14) and [Date] <= #date(2018, 2, 21))
    in
        #"Filtered Rows"


    Best Regards,
    Angelia