Forum Discussion
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))
Above link is my PBI file
Paul
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.
3 Replies
- AllisonKennedy
Community Champion
admin11 Do you have a measure you're trying to calculate as YTD?
There's no problem using the DATESYTD as you have, but you need only a MEASURE as the first input parameter/argument in TOTALYTD and you are using a boolean expression.
Try:
_YTD_REV_ =
TOTALYTD([Amount],'Date'[Date]),GL[1_REV] = "REV")
- admin11
Memorable Member
Hi Allison
Thank you for sharing.
I get error msg , i try to use 'G:[] also cannot.
- v-robertq-msft
Community Support
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.