0
votes

I'm trying to pass the day value as of today date in the advanced query editor

let 
    Source = GoogleBigQuery.Database(null),
    #"apple-5a221" = Source{[Name="apple-5a221"]}[Data],
    analytics_187358390_Schema = #"apple-5a221"{[Name="analytics_187358390",Kind="Schema"]}[Data],
    events_intraday_20200129_Table = analytics_187358390_Schema{[Name="events_intraday_20200129",Kind="Table"]}[Data]
in
    events_intraday_20200129_Table
1

1 Answers

0
votes

To pass Today dynamic date:

After spending an hour I found a solution [Name="events_intraday_"&datetime&"" and declare the datetime = DateTime.ToText(DateTime.LocalNow(), "yyyyMMdd")

let 
    datetime = DateTime.ToText(DateTime.LocalNow(), "yyyyMMdd"),
    Source = GoogleBigQuery.Database(null),
    #"apple-5a221" = Source{[Name="apple-5a221"]}[Data],
    analytics_187358390_Schema = #"apple-5a221"{[Name="analytics_187358390",Kind="Schema"]}[Data],
    events_intraday_20200129_Table = analytics_187358390_Schema{[Name="events_intraday_"&datetime&"",Kind="Table"]}[Data]
in
    events_intraday_20200129_Table

To pass Yesterday dynamic date:

datetime = Date.ToText(Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1), "yyyyMMdd")

let
    datetime =  Date.ToText(Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1), "yyyyMMdd"),
    Source = GoogleBigQuery.Database(null),
    #"prutopia-5a221" = Source{[Name="apple-5a221"]}[Data],
    analytics_187358390_Schema = #"apple-5a221"{[Name="analytics_187358390",Kind="Schema"]}[Data],
    events_datetime_Table = analytics_187358390_Schema{[Name="events_"&datetime&"",Kind="Table"]}[Data]
in
    events_datetime_Table