Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
5 years ago
Solved

How to use TOTALYTD command for compute YTD ?

Hi All My expression get error :- _YTD_REV_ = var _max = today() return calculate(TOTALYTD((GL[1_REV] = "REV"),'Date'[Date]),filter('Date','Date'[Date]<=_max))   https://www.dropbox.com...
  • v-robertq-msft's avatar
    5 years ago

    Hi, admin11 

    According to your DAX formula, I think that the true reason for this error is that you should use a measure or an expression as the first parameter of the TOTALYTD() function, you can try to use this measure:

    _YTD_REV_ =
    
    var _max = today()
    
    return
    
    calculate(TOTALYTD([AMOUNT],'Date'[Date]),GL[1_REV] = "REV",filter('Date','Date'[Date]<=_max))

    Then you can get the same value as the first measure you created, like this:

    You can download my test pbix file here

     

    More info about TOTALYTD() function

     

    Best Regards,

    Community Support Team _Robert Qin

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