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

Calculating YTD and MTD

Hi ..all

The below is the sample data set / format  i have ..what is my expression like in straight table if i will to get my YTD and MTD  SalesAmount ? 

Invoice date     SaleAmount

1/1/2021             4568

.

.

1/6/2021            1234

2/6/2021            4321

.

.

.

29/6/2021        8888

 

2 Replies
dineshm030
Creator III
Creator III

In Script add new  :

Year(Invoice date) as Cal_Year

Month(Invoice date) as Cal_Month

YTD:

Sum({<Cal_Year={$(=Max(Cal_Year))},Cal_Month= {"<=$(=max( Cal_Month))"}>}SaleAmount

MTD:

Sum({<Cal_Month= {"=$(=max( Cal_Month))"}>}SaleAmount

limfungkeat
Contributor III
Contributor III
Author

Thanks Dinesm030. Figures are shown now ..but the YTD and MTD is the same ..i wonder where goes wrong ...hmmmm