Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Please find attachement my sample data :
i need to calculate the sum of amount of max periodDate (of current Date)
and compare it with the Previous month
ID SumAmountMaxPeriodDate SumAmountPerviousMonth
this will b clear when the sample data that i have
sum({<[PeriodDate]={$(=max([PeriodDate]))}>}[Amount] it give me a Sum of CurrentMonth (as max periodDate) and
for the Previous Month i tried this expression
sum({<[PeriodDate]={$(=num(monthend(AddMonths(max([PeriodDate]),-1))))}>}[Amount]) it give me zero
MonthEnd will return the last second of a month: i.e. something like 01-01-2015 23:59:59. Your PeriodDate values won't have that time fraction. If you want the last day of the previous month try $(=num(MonthStart(max([PeriodDate]))-1) )
Try like this
sum({<[PeriodDate]={">=$(=max([PeriodDate])-1)"}>}[Amount]
hi Gysbert should i add AdMonths() before the periodeDate?
you can use floor to get rid of the fractions from the month end function, and when using monthend you can define the offset
sum({<[PeriodDate]={$(=num(floor(monthend((max([PeriodDate]),-1))))}>}[Amount])
Hi Ramon i tried this Expression and it give me Zero anything wrong in the syntax ?
sum({<[PeriodDate]={$(=num(floor(monthend(max([PeriodDate]))-1)))}>}[Amount])
Hi Sunil Kumar this is giving me the Sum of Amount of the Current month not the Previous one
Can you help to find the sum of Amount of the Previous Month ?
this expression is givin me Zero
you are missing the coma for the monthend function
sum({<[PeriodDate]={$(=num(floor(monthend(max([PeriodDate]),-1))))}>}[Amount])