Forum Discussion
Total YTD
- Anonymous4 years ago
Hi mith_tina ,
Try this measure and use [Year] as the axis, this should return the correct result.
Total YTD = VAR _date = EOMONTH ( TODAY (), -1 ) VAR _year = MAX ( 'Calendar'[Year] ) VAR _month = MONTH ( _date ) VAR _day = DAY ( _date ) VAR _total = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( _year, 1, 1 ) && 'Calendar'[Date] <= DATE ( _year, _month, _day ) ) ) RETURN _totalThe PBIX file is attached for reference.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi mith_tina ,
Try this measure and use [Year] as the axis, this should return the correct result.
Total YTD =
VAR _date =
EOMONTH ( TODAY (), -1 )
VAR _year =
MAX ( 'Calendar'[Year] )
VAR _month =
MONTH ( _date )
VAR _day =
DAY ( _date )
VAR _total =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
'Calendar',
'Calendar'[Date] >= DATE ( _year, 1, 1 )
&& 'Calendar'[Date] <= DATE ( _year, _month, _day )
)
)
RETURN
_total
The PBIX file is attached for reference.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data