Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Im' trying to do adapt a Excel Function, to a Query in Power Query, but I'm having a lot of trouble.
I convert the date to "RYYMMM" where "YY" are the last two digits of the month and "MMM" is the abreviation in uppercase of the Month. But the problem is when I try to put the criteria, that this format should be only applied if the date in question is before TODAY()-2 months.
The Excel Formula is the following:
=IF(OR([@[Data de Distribuição]]="";[@[Data de Distribuição]]="MODEL");"";IF(DATE(YEAR([@[Data de Distribuição]]);MONTH([@[Data de Distribuição]]);1)<=DATE(YEAR(TODAY());MONTH(TODAY())-2;1);CONCATENATE("R";UPPER(TEXT(DATE(YEAR([@[Data de Distribuição]]);MONTH([@[Data de Distribuição]]);1);"AAMMM")));""))
In Power query, I'm typing this on the custom column:
if #date(Date.Year([DataPrazoCumprido]), Date.Month([DataPrazoCumprido],Date.StartOfMonth([DataPrazoCumprido]))) <= Date.AddMonths(#date(DateTime.LocalNow()), 2) then "R" & Text.End(Date.ToText(DateTime.Date([DataPrazoCumprido])),2) & Text.Upper(Date.ToText([DataPrazoCumprido],"MMM" ))
else null
The part after "then" works just fine (as shown on the highlited image), but when I try to do it with the criteria, it returns this error:
Expression.Error: 2 arguments were passed to a function which expects 1.
Details:
Pattern=
Arguments=[List]
Can anyone help me please?
Solved! Go to Solution.
Hi @Pererelson ,
I think that you may want to use #date(year,month,day). Please refer to the following codes:
#date(Date.Year([DataPrazoCumprido]), Date.Month([DataPrazoCumprido]),Date.Day(Date.StartOfMonth([DataPrazoCumprido])))
Hi @Pererelson ,
I think that you may want to use #date(year,month,day). Please refer to the following codes:
#date(Date.Year([DataPrazoCumprido]), Date.Month([DataPrazoCumprido]),Date.Day(Date.StartOfMonth([DataPrazoCumprido])))
Missing Bracket?
Date.Month([DataPrazoCumprido],
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.