Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to get Previous Month Value when i make a selection, but struggling to get it right?
E.g if i select May on a list box it must show me values for April.
like -1
i Tried:
=sum({<Dates={'>=$(=only(Dates)-2)<=$(=only(Dates))'}>}Sales)
and
=sum( {$<Year = {$(=Only(Year)-1)}>} Sales )
im i missing something in here?
Regards:
Thabiso
try like this:
sum({<Month_Name={'>=$(monthname(monthname(date)-1)'}>}Sales)
and
=sum( {$<Year = {"$(=(Year-1)"}>} Sales )
Hi,
What do you mean in Month_Name? and what should i use as a Dimension?
Are you trying to do this on a chart where Month is your dimension? If yes than you will have to use Above() function. If not then this should work:
=Sum({<Dates={">=$(=Date(AddMonths(Max(Dates), -1), 'DatesFieldFormat')) <= $(=Date(Max(Dates)))"}>} Sales)
or
=Sum({<Dates={"$(='>=' & Date(AddMonths(Max(Dates), -1), 'DatesFieldFormat') & '<=' & Date(Max(Dates)))"}>} Sales)
That is why it is better to post sample app, to understand better by the community members. no offence.
Hi All,
i want to use it on a Straight Table, so i just need sample Test so that i can Apply it on my Large Data Set, i created a Sample Model.
Regards.
Can you share your sample with us? It will be easier to understand your structure and give you recommendations.
Best,
Sunny
Do you just want the value for april when you select april?
Then it is:
sum({$<Year,Month,Date={">=$(=MonthStart(Min(Date),-1))<=$(=MonthEnd(Min(Date),-1))"}>} SalesAmount)
If you want to show the value for april next to may in a seperate column like this:
Month Sales Sales Last Month
April
May
Jun
Then i suggest that you take a look at this post, where I do somethng similar:
Re: Last Year and Current Year Sales in Current Year Only
//Martin
Hi,
Sample Data:
Day | MonthDate | Dates | Year | Sales |
---|---|---|---|---|
10 | Jan | 2015-01-10 | 2015 | 100 |
24 | Feb | 2015-02-24 | 2015 | 23 |
24 | Mar | 2015-03-24 | 2015 | 45 |
10 | May | 2015-05-10 | 2015 | 345 |
Listbox:
MonthDate:
Jan
Feb
Mar
Apr
May
Jun
So if i select Mar it must show me values for Feb.....and if i select Feb it must show values for Jan.....and so on
Hope this will help
Thanks
Hi,
Basically it has to calculate for Previous Month
e.g if i press Jun, it must give me sales for May
Thanks.