Ahmed Abdul Salam
Ahmed Abdul Salam

Reputation: 5

Filter Dates which are NOT in current month using power Query

in power bi's query editor, i needed a date column to be split into two more columns. One as "In current month" and the other one is "Not in current month"

for "In current month" i used Date.IsInCurrentMonth, now i need the same for "Not in Current Month"

any help is appreciated.
Ty.

Upvotes: 0

Views: 8072

Answers (3)

kelzeki
kelzeki

Reputation: 1

I know this is an old post, I did something slightly different because I didn't want to you the IF statement.

Logical.ToText(Date.IsInCurrentMonth([PROCESSDATE])) = "false"

Upvotes: 0

Alexis Olson
Alexis Olson

Reputation: 40304

Just use not.

if not Date.IsInCurrentMonth([Date])
then "Not in Current Month"
else "In Current Month"

Or the other way around

if Date.IsInCurrentMonth([Date])
then "In Current Month"
else "Not in Current Month"

Upvotes: 2

Siva
Siva

Reputation: 9101

Try this formula that worked for me:

if (Date.Month([Order Date]) = Date.Month(DateTime.Date(DateTime.LocalNow())))
then "Current Month"
else "Not Current Month"

Upvotes: 0

Related Questions