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
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 ?
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.
- Anonymous2 years agoNot applicable
Here is my formula
ChargesYTD = TOTALYTD(SUM(Table_2024[Charge]),Calendar[DateKey])If I choose MonthName from the Calendar table, I get no data. No charges pop up.- Anonymous2 years agoNot applicable
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
- Anonymous2 years agoNot applicable
Thank you. It worked for each day calculation. Not monthly.