Forum Discussion

Gopinath_iyer's avatar
Gopinath_iyer
Icon for Helper II rankHelper II
4 years ago
Solved

YTD basis current month

Hi

 

I need to create YTD value but till current month only. like in the below table YTD should be 3263.7 as we are in June month and next month it should be 3807.65.

 

MonthAmount
Jan'22543.95
Feb'22543.95
Mar'22543.95
Apr'22543.95
May'22543.95
Jun'22543.95
Jul'22543.95
Aug'22543.95
Sep'22543.95
Oct'22543.95
Nov'22543.95
Dec'22543.95
  • Hi, Gopinath_iyer 

     

    In your case, it would be better to need a date column.

    YTD =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER ( ALL ( 'Table' ), MONTH ( [Date] ) <= MONTH ( TODAY () ) )
    )
    

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Seanan's avatar
    Seanan
    Icon for Solution Supplier rankSolution Supplier

    Hi Gopinath_iyer 

     

    You can create a measure to calculate this using the following code. Just replace the 'Table (4)'[Amount] with your own values

    CurrentYTD = TOTALYTD(SUM('Table (4)'[Amount]),'Table (4)'[Dates], 'Table (4)'[Dates] < TODAY())

     

    If this helps solve your issue please could you accept this as the solution.

    Kind regards,

    Seanan

  • Hi Gopinath_iyer 

     

    If there is no Date table and your Month column is a date column, you can use the below DAX:

    YTD = CALCULATE(SUM('Table'[Amount]),'Table'[Date or Month]<=TODAY())
    If your Month Column is not a date column, you need to add a date column to your table and use that in the formula.
     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Gopinath_iyer 

     

    In your case, it would be better to need a date column.

    YTD =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER ( ALL ( 'Table' ), MONTH ( [Date] ) <= MONTH ( TODAY () ) )
    )
    

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.