Hello..
I' am hoping you can help, below is my code for a PowerBI Query..... the sales data is my main table of data and the "AndCriteria" are filters such as dates names referenced from a cell... for example if someone enters date 01/01/2019 in cell A2 then it will return data from that date onward.... the problem I have is in the "WholesalerCriteria" it works if the cell is populated, however if the cell is blank i would like it to return all text, but it returns nothing. please help
Below is the code:
let
AndCriteria01 = WholesalerCriteria,
AndCriteria02 = Date_From_YR,
AndCriteria03 = Date_From_Month,
AndCriteria04 = From_Day,
AndCriteria05 = To_Year,
AndCriteria06 = To_Month,
AndCriteria07 = To_Day,
Source = Access.Database(File.Contents("MySource"), [CreateNavigationProperties=true]),
#"_#sales_data" = Source{[Schema="",Item="#sales_data"]}[Data],
#"Filtered Rows" = Table.SelectRows(#"_#sales_data", each Text.Contains([Cust_Wholesaler], WholesalerCriteria)),
#"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [D_Date] >= #datetime(Date_From_YR,Date_From_Month,From_Day,0,0,0)),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each [D_Date] <= #datetime(To_Year, To_Month, To_Day, 0, 0, 0))
in
#"Filtered Rows2"
I' am hoping you can help, below is my code for a PowerBI Query..... the sales data is my main table of data and the "AndCriteria" are filters such as dates names referenced from a cell... for example if someone enters date 01/01/2019 in cell A2 then it will return data from that date onward.... the problem I have is in the "WholesalerCriteria" it works if the cell is populated, however if the cell is blank i would like it to return all text, but it returns nothing. please help
Below is the code:
let
AndCriteria01 = WholesalerCriteria,
AndCriteria02 = Date_From_YR,
AndCriteria03 = Date_From_Month,
AndCriteria04 = From_Day,
AndCriteria05 = To_Year,
AndCriteria06 = To_Month,
AndCriteria07 = To_Day,
Source = Access.Database(File.Contents("MySource"), [CreateNavigationProperties=true]),
#"_#sales_data" = Source{[Schema="",Item="#sales_data"]}[Data],
#"Filtered Rows" = Table.SelectRows(#"_#sales_data", each Text.Contains([Cust_Wholesaler], WholesalerCriteria)),
#"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [D_Date] >= #datetime(Date_From_YR,Date_From_Month,From_Day,0,0,0)),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each [D_Date] <= #datetime(To_Year, To_Month, To_Day, 0, 0, 0))
in
#"Filtered Rows2"