Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

YTD date range selector

mszpot89
9 - Comet

I'm trying to get date selector interface for my end users so they will be able to define YTD date range on their side (1-OCT up to first day of month)

The issue I have is how to setup the expression part so it would be captured by interface buttons.

 

image.png

 

 

9 REPLIES 9
patrick_mcauliffe
14 - Magnetar
14 - Magnetar

For the most part it looks like you have it set up correctly - just maybe some extra tools.

I would just use a single Date interface tool, connected to one and only Filter tool. 

If it is always going to be YTD then you could use a formula like this:

[Date]>=(ToString(DateTimeYear('2018-01-01'))+'-01-01')
And
[Date]<DateTimeTrim('2018-01-01','month')

 

Have the Update tool replace 2018-01-01 with the date coming in from the Date Interface tool.

 

mszpot89
9 - Comet

@patrick_mcauliffe - you file is not working, could you re-send ?

mszpot89
9 - Comet

I made some edits but still no success.

image.png

 

 

 

patrick_mcauliffe
14 - Magnetar
14 - Magnetar

@mszpot89  

I've attached a new one which is much more simplified.

You'll have to save first, then right click --> edit to see how it works and build off of it.

 

mszpot89
9 - Comet

Great thanks @patrick_mcauliffe but still user needs to check both dates at his end.

 

patrick_mcauliffe
14 - Magnetar
14 - Magnetar

@mszpot89  Again, you'll probably have to modify this to suit your specific need; but attached is how I would do it if you want the user to be able to select both start and end months.

mszpot89
9 - Comet

@patrick_mcauliffe I did one litle edit ;)

 

If I wanted 10-1-2017 to 12-1-2017 range the workflow returns 11-1-2017 to 12-1-2017, this is how I accommodated it:

[Month]>=DateTimeAdd('2018-01-01',-1,'month')
And
[Month]<DateTimeTrim('2018-02-01','month')

 

patrick_mcauliffe
14 - Magnetar
14 - Magnetar

@mszpot89

Looks like that's happening because the formula is time stamp specific.

Try this formula instead:

 

[Month]>DateTimeAdd(DateTimeTrim('2018-01-01','month'),-1,'day')
And
[Month]<DateTimeTrim('2018-02-01','month')

mszpot89
9 - Comet

This works as well @patrick_mcauliffe

 

[Month]>=DateTimeAdd('2018-01-01',-1,'month')
And
[Month]<DateTimeTrim('2018-02-01','month')

 

Labels