Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Choose Current Year

azuzu
7 - Meteor

hi, i have an issue to identify current year in the table.

 

Let say today is in 2017, but I want to identify 2016 as Current Year and then will be filtered out.

This workflow should be flexible with the update of the year. For example, if we are in 2018, the Current Year then will be 2017. 

 

i have tried to use max function but seems it is not working.

7 REPLIES 7
azuzu
7 - Meteor

This is the output that I have worked on. Is there any other simpler way to do such this thing?

JoeS
Alteryx
Alteryx

Hi @azuzu

 

I have written it into one formula for you in the attached workflow.

 

The formula is:

IF
ToNumber(DateTimeFormat(DateTimeToday(),"%Y")) - [Year] = 1
Then "Yes"
ELSE "No"
ENDIF

To break it down, I used: DateTimeFormat(DateTimeToday(),"%Y") to get the year from today's date. I then need to ToNumber this as Alteryx treats dates as string values.

 

Then you can perform your if statement that you had previously.

 

Hopefully this helps.

 

Thanks

Joe

vishwa_0308
11 - Bolide

Hi,

 

You can use this expression and this will give you previous year as a result.

 

DateTimeFormat(DateTimeAdd(DateTimeNow(),-1,"Year"),"%Y")

 

Regards,

Vishwa

azuzu
7 - Meteor

Hi @JoeS

 

I could not open your workflow as it shows an error due to different version. I am using v11.0

JoeS
Alteryx
Alteryx

Hi @azuzu

 

No worries, I have changed it to version 11 for you now.

 

There is a link on the community about how to change them if you need it in future too:

https://community.alteryx.com/t5/tkb/articleprintpage/tkb-id/knowledgebase/article-id/854

 

Thanks

Joe

azuzu
7 - Meteor

Hi @JoeS,

 

Thanks! It works perfectly!

JoeS
Alteryx
Alteryx

No problem, happy to help :)

Labels