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
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.
Here is my formula
- 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. I tried the second option and it worked.