cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Re: Creating a new column that returns the date 1st of march the year after operation date

@Thejeswar  I have tried to do this and it still does not work. For example I have an operation date of 29.05.20 in my dataset and this returns 01.03.20 in the new column and not 29.05.20. 

Do you have an idea of where the problem is?

 

My coding looks like this (exactly like yours):

opdate season.png

Highlighted
Solution Sage
Solution Sage

Re: Creating a new column that returns the date 1st of march the year after operation date

Hi @ErikAH ,

This thing not working for 29.05.20 is an expected scenario.

The Script is written such that if the data is of month 3 and an data, it will show the same data,

if the data is from months 1 and 2, it will show 1.3.(that year)

for other dates it will show 1.3.nextyear

 

So for 29.05.20 it is showing 01.3.21

 

Thejeswar_0-1593769520541.png

Use the below modified script. The Below script returns the data as it is if it is greater that 1-Mar of the current year and for all prior dates as you wanted. The Output also given below.

 

Ops Day Seasonality = 
var _curryear = YEAR(TODAY())
var _year = Year('Table'[Operation date])
var _month = Month ('Table'[Operation date])
var _day = Day('Table'[Operation date])

RETURN
IF('Table'[Operation Date] >= DATE(YEAR(TODAY()),  03, 01), 'Table'[Operation Date],
SWITCH(
    TRUE(),
    _month = 1 || _month = 2   ,Date (_year, 3,1),
    Date (_year+1, 3,1)
    )
    )

 

Thejeswar_1-1593770022166.png

 

If this answers your quetion, accept as soluion and give a kudos!!!

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.