Search code examples
excelfunctiondatelogicpowerquery

In PowerQuery, how can I convert a value of type Function to type Logical


I'm using PowerQuery within Excel, not PowerBI.

I've got a column full of application dates.

If the application date is within the last week I want to return 1, if not I want to return 0.

Then I can simply sum the number of applications made in the week, and repeat this process for the month, and the year.

I'm using the Date.IsInCurrentWeek function, and trying to combine it with a logical expression, like below:

= Table.AddColumn(#"Reordered Columns", "App.CurrentWeek", if each Date.IsInCurrentWeek([Application Date]) = "FALSE" then 0 else 1)

But the error I'm receiving is

Expression.Error: We cannot convert a value of type Function to type Logical. Details: Value=[Function] Type=[Type]


Solution

  • Try each if instead of if each