cancel
Showing results for
Did you mean:
Helper V

## Create column with true/false for previous month

Hello,

I have a column with dates in the following format:

d/m/yyyy

How can I create a calculated column that has as values true for every entry that is on the previous month and false for the rest?

I tried the following but it didn't work.

=IF([Date]=EDATE(DATE(YEAR(NOW());MONTH(NOW()));-1);TRUE();FALSE())

I know I must be close but how can I implement the day to my formula?

1 ACCEPTED SOLUTION
Community Champion

@mork This should work...

```Column =
IF ( YEAR ( Calendar[Date] ) = YEAR ( NOW () )
&& MONTH ( Calendar[Date] ) = MONTH ( NOW () ) - 1,
TRUE (),
FALSE ()
)```
5 REPLIES 5
Community Champion

@mork This should work...

```Column =
IF ( YEAR ( Calendar[Date] ) = YEAR ( NOW () )
&& MONTH ( Calendar[Date] ) = MONTH ( NOW () ) - 1,
TRUE (),
FALSE ()
)```
Solution Supplier

Hi Mork,

This should do the trick:

=IF(STARTOFMONTH(YourTable[YourDateField]) = date(year(TODAY()); MONTH(today())-1; 1) ;TRUE();FALSE())

HTH,

Cheers, Edgar Walther
ITsmart BI and Analytics consultant
Power BI User Group Netherlands
Frequent Visitor

if(month(date)=month(date)-1,"True","False")

Community Champion

@mork This should work for you however in your dateColumn you will only need date that is not greater than today.

NewColumn = IF( DATEDIFF('YOURTABLE'[dateColumn],TODAY(),DAY) <= 30, "Yes", "No")

Helper V

@ankitpatira

Unfortunately that's is not what I want. Your formula is about the previous 30 days and not about the previous month. So for example today is the 13th of May. The data that I will see won't be the data of the previous month but will be the data of the last 30 days. Meaning half of April and half of May.

Announcements

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors