Forum Discussion
TOTALYTD Question
- 2 years ago
Hi Anonymous - Please create a seperate Date table, it works.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!! - Anonymous2 years ago
Hi Anonymous ,
Please try:Charges YTD = VAR LastMonthAvailable = MAX ( 'Calendar'[Month-Year-Sort] ) VAR LastYearAvailable = MAX ( 'Calendar'[Year] ) VAR Category = MAX( 'Table1'[Category] ) VAR Result = CALCULATE ( [Total Charges], REMOVEFILTERS ( 'Calendar' ), 'Calendar'[Month-Year-Sort] <= LastMonthAvailable, 'Calendar'[Year] = LastYearAvailable, VALUES('Table1'[Category]) ) RETURN Resultor:
Charges YTD 2 = CALCULATE([Total Charges],DATESYTD('Calendar'[Date]),VALUES('Table1'[Category]))or:
Charges YTD 3 = TOTALYTD([Total Charges],'Calendar'[Date],VALUES(Table1[Category]))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 in the Power BI Forum -- China Power BI User Group
Hi Anonymous - I hope you already have the seperate date table and marked it as date, if not please create it.
create a quick date table using the date in your YTD Measure.
Date = CALENDAR(DATE(2024, 1, 1), DATE(2024, 12, 31))
YTD Measure:
Charges_YTD =
TOTALYTD(
SUM('Table1'[Charge]),
'Date'[Date]
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
- Anonymous2 years agoNot applicable
Aah. So I have to have the Date column in a separate calendar table and it cannot be part of the other data is that the reason ? Should the Date be always separate ?
- rajendraongole12 years agoSuper User
Hi Anonymous - Please create a seperate Date table, it works.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!- Anonymous2 years agoNot applicable
It looks like works. But I now have a different issue.
Attaching 2 pictures
Its not visible - but I have joined on Post Date - Date and DateKey
If I track Charges YTD as highlighted here - the numbers seem right as it builds on the previous date.
BUT - I just want to see Months not each day. Creating a date hierachy for that column is not getting me the right number.
I tried to right click to see if Collapse option was there and nothing there.
What am I missing here ? Thanks.