The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a two tables - one takes source direcly from SQL, and I am adding another formated in Power bi and I need to apply the same filters. And here is where my issues start
The SQL has it like this:
WHERE MONTH(date_order) = MONTH(CURRENT_DATE())#(lf)AND YEAR(date_order) = YEAR(CURRENT_DATE())
The table I have in sql comes from a different place so I need to apply this in power BI.
I created a custom column and I want to filter values 1 later:
if Date.Month([date_of_order]) = Date.Month(Date.From(DateTime.LocalNow()))
&
Date.Year([date_of_order]) = Date.Year(Date.From(DateTime.LocalNow()))
then "1" else"0"
But this gives me an error which I do not understand:
Any ideas how to fix it?
Solved! Go to Solution.
Try the below code.
if Date.Month([date_of_order]) = Date.Month(Date.From(DateTime.LocalNow()))
and
Date.Year([date_of_order]) = Date.Year(Date.From(DateTime.LocalNow()))
then "1" else"0"
Try the below code.
if Date.Month([date_of_order]) = Date.Month(Date.From(DateTime.LocalNow()))
and
Date.Year([date_of_order]) = Date.Year(Date.From(DateTime.LocalNow()))
then "1" else"0"
This worked, so seems power query does not like & signs. Thanks