cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
obuolys123
Helper I
Helper I

This month and last month dates

I have a date table and I need to create a Calculated Column for date values that are within this month and last month. For example, today is 06-21, so I need that date would be displayed from TODAY till 05-01. Other values should be BLANK.  As the data refreshes, I need the fact of 2 months to move also. So if the date is 07-21, I need it till 06-01. IF in DAX should work somehow, but I was unable to write it correctly. I attached a photo of the example below.
Thank you.

obuolys123_0-1655800370992.pngobuolys123_1-1655800381046.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a column like

New Column =
var startDate = EOMONTH(TODAY(), -2) + 1
return IF( 'Date'[Date] >= startDate && 'Date'[Date] <= TODAY(), 'Date'[Date])

View solution in original post

2 REPLIES 2
obuolys123
Helper I
Helper I

Thank you, @johnt75 . That's exactly what I wanted.

johnt75
Super User
Super User

You could create a column like

New Column =
var startDate = EOMONTH(TODAY(), -2) + 1
return IF( 'Date'[Date] >= startDate && 'Date'[Date] <= TODAY(), 'Date'[Date])

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors