0
votes

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.

3

3 Answers

2
votes

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"
0
votes

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"
0
votes

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"