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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
aatish178
Helper IV
Helper IV

How to create a calculated date column using an existing date column

Hi All, I have a ReportDate column in a table.

This column has dates from 1974-01-01 till 2026-01-01

and I want to create another calculated column using that existing ReportDate column.

The new column should only show ReportDate ranges from Last 3 years(from todays date) till Today's Month end.

for ex. if today is 12th August 2024 then it should only show dates from 12th Aug 2021 till 31st Aug 2024

 

can someone please help how to create a new column with expected dates

@amitchandak @v-huijiey-msft @gmsamborn @v-kaiyue-msft @v-jialongy-msft  @Ashish_Mathur @quantumudit @quantumudit1

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@aatish178 , Try creating a new calculated column using below 

 

NewReportDate =
VAR TodayDate = TODAY()
VAR StartDate = EDATE(TodayDate, -36) -- 36 months back from today
VAR EndDate = EOMONTH(TodayDate, 0) -- End of the current month
RETURN
IF(
'YourTable'[ReportDate] >= StartDate && 'YourTable'[ReportDate] <= EndDate,
'YourTable'[ReportDate],
BLANK()
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@aatish178 , Try creating a new calculated column using below 

 

NewReportDate =
VAR TodayDate = TODAY()
VAR StartDate = EDATE(TodayDate, -36) -- 36 months back from today
VAR EndDate = EOMONTH(TodayDate, 0) -- End of the current month
RETURN
IF(
'YourTable'[ReportDate] >= StartDate && 'YourTable'[ReportDate] <= EndDate,
'YourTable'[ReportDate],
BLANK()
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.