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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Future Dates Based On Multiple Conditions

Pressed with a deadline, please help.

 

I am trying to structure a logic but doesn't seem to work out. I have a table that contains discrete as well as duplicate Dates.

What I need is "first-date-of-the-month" in future based on these date values, meeting the following conditions.

 

1: If the day number of date in CloseDate is less than 15, I want the first of the 5th month.
2: If the day number of date in CloseDate is greater than 15, I want the first of 6th month.

3: if CloseDate is NULL - Last Date of current Month

 

Side note: I will be using this future date in calculations, do you think "Calucated Column" is the right approach or should I think of Measure?

 

1.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @Anonymous !

 

Try this...

 

Future Date = 
IF(
    DAY(Sheet1[CloseDate]) < 15,
    DATE(YEAR(EDATE(Sheet1[CloseDate],5)), MONTH(EDATE(Sheet1[CloseDate], 5)), 1),
    DATE(YEAR(EDATE(Sheet1[CloseDate],6)), MONTH(EDATE(Sheet1[CloseDate], 6)), 1)
)

CalculatedColumn.PNG

 

Personally, I think the column is fine here as you are not calculating an aggregate, but rather row-by-row.

 

Hope this helps.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hey @Anonymous !

 

Try this...

 

Future Date = 
IF(
    DAY(Sheet1[CloseDate]) < 15,
    DATE(YEAR(EDATE(Sheet1[CloseDate],5)), MONTH(EDATE(Sheet1[CloseDate], 5)), 1),
    DATE(YEAR(EDATE(Sheet1[CloseDate],6)), MONTH(EDATE(Sheet1[CloseDate], 6)), 1)
)

CalculatedColumn.PNG

 

Personally, I think the column is fine here as you are not calculating an aggregate, but rather row-by-row.

 

Hope this helps.

Anonymous
Not applicable

Sweet like CTRL+Z ... Worked Perfectly .. Thanks a lot. 

 

~ I was tying to shoot "DateAdd" bullet.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors