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 ,
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
Result
or:
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 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 in the Power BI Forum -- China Power BI User Group
Thank you. I tried the second option and it worked.