Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

two months only

Hi all,

I want to show   last two months  in bar chart

Flters:

year :2016

like   if I select  dec 2016   in bar chart I want to display  oct 2016 and nov 2016.

so when ever I select any month it should show  before two months data dynamically.

can anyone show me the expression to achieve this?

Thanks

Sony

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

Create a date field from MonthYear as MonthStart

Sum({$<[MonthStart]={">=$(=Date(AddMonths(Max(MonthStart),-2)))"}>}[Invoive Total])

View solution in original post

5 Replies
Anonymous
Not applicable

                    Sum({$<[MonthYear]={"$(=Date(AddMonths(Max(MonthYear), -2), 'MMM-YYYY'))"}>}[Invoive Total])

soniasweety
Master
Master
Author

Hi,

it is showing '0'

shraddha_g
Partner - Master III
Partner - Master III

What is the format of MonthYear Field?

Date or String?

shraddha_g
Partner - Master III
Partner - Master III

Create a date field from MonthYear as MonthStart

Sum({$<[MonthStart]={">=$(=Date(AddMonths(Max(MonthStart),-2)))"}>}[Invoive Total])

Not applicable

Make 2 variable.

1st one is:

Previous Month: =month(MakeDate(2000,vMaxMonth-1))

2nd one is:

2nd last Previous Month: =month(MakeDate(2000,vMaxMonth-2))

vMaxMonth: =Month(Max(DATE))

In Bar chart expression will be

For Previous Month: Sum({<Year={$(=Max(Year))},Month={'$(vPreviousMonth)'}>}Sales)

For 2nd last previous Month: Sum({<Year={$(=Max(Year))},Month={'$(v2ndPrvmonth)'}>}Sales)