
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AddMonths for multiple values
Hello!
I have a statement:
=Date(AddMonths(Date#((GetFieldSelections([Rok-Miesiąc], ', ', 99)), 'YY-MM'), -12), 'YY-MM')
and it works if the end user picks only one date - e. g. if he picked 19-06 it prints out the 18-06 value.
If he picks two or more dates it doesn't work, but the statement without AddMonths works perfectly - it prints all the values the user picked.
Why the AddMonths works only for one value? How can I change the statement to make it work?
I tried to use Concat, but it still doesn't work.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try like:
Concat( Distinct Date(AddMonths(Date#([Rok-Miesiąc], 'YY-MM'), -12), 'YY-MM'), ',')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The expression you are using is potentially wrong. Where are you using this expression, in a chart, or textbox? Try to share a sample app explaining your expected output with context.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a defined calendar loaded by a script, the end user can pick dates (YY-MM) from the list.
I use this expression in a textbox and I expect that the expression will print picked dates but from previous year, so:
1) the end user picks 19-06, 19-05 and 19-01.
2) the textbox shows 18-06, 18-05, 18-01.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try like:
Concat( Distinct Date(AddMonths(Date#([Rok-Miesiąc], 'YY-MM'), -12), 'YY-MM'), ',')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works, thank you!
I also added IF(GetSelectedCount([Rok-Miesiąc])<>0 at the beginning to make it work only after picking dates 🙂
