Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Previous month calculation

Hi Community,

 

I need to set a Column with a 1 or 0 if a value in a column is new in the Current Month (1) or if it is the same in previous month (0).  How can I do that?  I have tried many ways but I haven't been able to get to it.

 

Here is a sample 

 

MonthAgreementIs Agreement New?
12/1/2020101
12/1/2020111
12/1/2020291
12/1/2020211
12/1/2020201
12/1/2020111
1/1/2021110
1/1/2021401
1/1/2021290

 

Thanks...

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

you can create a column

Column = if(ISBLANK(maxx(FILTER('Table','Table'[Agreement]=EARLIER('Table'[Agreement])&&'Table'[Month]<EARLIER('Table'[Month])),'Table'[Month])),1,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(ISNUMBER(CALCULATE(COUNTROWS(Data_2),FILTER(Data_2,Data_2[Agreement]=EARLIER(Data_2[Agreement])&&Data_2[Month]<EARLIER(Data_2[Month])))),0,1)

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

You want a DAX calculated column or M? Here is one DAX column

 

Vera_33_0-1617068581624.png

Is Agreement New? = 
VAR PreMonth = DATEADD(AgreementTable[Month],-1,MONTH)
VAR CurAgreement = AgreementTable[Agreement]
VAR T1 = SELECTCOLUMNS(FILTER(ALL(AgreementTable),AgreementTable[Month]=PreMonth),"NEW",[Agreement])
RETURN
IF(CurAgreement IN T1,0,1)

 

ryan_mayu
Super User
Super User

@Anonymous 

you can create a column

Column = if(ISBLANK(maxx(FILTER('Table','Table'[Agreement]=EARLIER('Table'[Agreement])&&'Table'[Month]<EARLIER('Table'[Month])),'Table'[Month])),1,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi Ryan_mayu

 

Great solution.  It solved what we were looking for.

 

Regards,

 

Albin

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.