Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a question about dates in dimension. What i want to do is to show last 5 months as dimension in a bar chart, as my file is growing i don't want to show all the available dates, but only the last 5 month.
What i have for now (not working) is below code:
=If(([Cycle Date] > {$<[Cycle Date] = {$(=date(AddMonths(max([Cycle Date]),'-5',0),'MM.YYYY'))}>}),date([Cycle Date],'MM.YYYY'),Null())
This should only show the dates that are from max month to -5 months, but i get invalid dimension in bar chart and i get all the dates in a table when the formula is shown as a measure.
Can someone please help me with this?
Thank you in advance.
@Sunkanx try below
date(aggr(only({$<[Cycle Date] = {">$(=date(AddMonths(max([Cycle Date]),'-5')))<=$(=date(max([Cycle Date])))"}>}[Cycle Date]),[Cycle Date]),'MM.YYYY')
@Sunkanx try below
date(aggr(only({$<[Cycle Date] = {">$(=date(AddMonths(max([Cycle Date]),'-5')))<=$(=date(max([Cycle Date])))"}>}[Cycle Date]),[Cycle Date]),'MM.YYYY')
This is exactly what i needed. Thank you so much. I had to fix the formatting in the part where you defined between dates. Final solution is:
date(aggr(only({$<[Cycle Date] = {">$(=date(AddMonths(max([Cycle Date]),'-5'),'MM.YYYY'))<=$(=date(max([Cycle Date]),'MM.YYYY'))"}>}[Cycle Date]),[Cycle Date]),'MM.YYYY')
Null values excluded