Forum Discussion

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

Return Current Year Only

I need this to return Current year only. Also if I could get a separate means to return previous year only in a different measure. I am stuck and have searched all over for a solution.    OB YTD S...
  • v-zhangti's avatar
    v-zhangti
    4 years ago

    Hi, bstark1287 

     

    You can try the following methods.
    Column:

    Month = FORMAT([Date],"mmmm")

    Measure:

    Current Year =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Calendar' ),
            [Month] = SELECTEDVALUE ( 'Calendar'[Month] )
                && YEAR ( [Date] ) = YEAR ( TODAY () )
        )
    )
    
    Previous year =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Calendar' ),
            [Month] = SELECTEDVALUE ( 'Calendar'[Month] )
                && YEAR ( [Date] )
                    = YEAR ( TODAY () ) - 1
        )
    )
    

    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.