Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
q11hhg
Contributor III
Contributor III

table chart last 12 month calculation does not return as expected

 

Hi,

could you please tell me why my calculation is not returning the expected result? 

q11hhg_1-1614592649342.png

 

q11hhg_0-1614592612320.png

in the table the Registered measure should take the date on each column as the max date and then calculate back 12 months  from that date , according to the expression: like this:

how can I fix it?

q11hhg_2-1614592813432.png

 

 

 

Labels (2)
1 Reply
Chanty4u
MVP
MVP

try this

 

sum({< Date={">=$(=max([Period ID])-12)<=$(=max([Period ID]))"}>} Sales)

 

or

=Sum({$<Date={">=$(=Date(MonthStart(AddMonths(Max(Date),-11)),'YYYYMMDD'))<=$(=Date(MonthStart(AddMonths(Max(Date),0)),'YYYYMMDD'))"}>} Distinct Sales)

or

sum({<dateField={">=$(=date(addmonths(today(),-11)))<=$(=date(today()))"}>}Sales)

 

or

=sum({<Date = {'>=$(=vVar1)<=$(=vVar)'}>}Sales)

vVar1

=AddMonths(Date,-12)

vVar

=AddMonths(Date,0)