Power BI If statement from another table

rambans21

New Member
Joined
Nov 12, 2018
Messages
3
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"
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
add custom column with text, eg. "ALL" then use condition column, eg. if WholeSaleCriteria is blank use columnALL else use WholeSaleCriteria.
use condition column in your filter
after that remove columnALL to not show it in the sheet
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,971
Members
452,540
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top