Forum Discussion
Anonymous
4 years agoNot applicable
Dax - YTD
Hello all,
Please help me to calculate YTD-2021 and YTD 2022. I have posted the result.Please find the attached images.Thank You
RaptorFox Hariharan_R Tahreem24
Refer the attached PBIX file.
2021 YTD = CALCULATE(TOTALYTD(SUM('Table'[Qty]),'Date'[Date]),'Table'[Year]=2021)Thanks
Hari
Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.
2 Replies
- Barthel
Solution Sage
Hey,
You can use these DAX codes to add calculated columns:
YTD-2022 = VAR CurrentMonth = DATEVALUE ( "1 " & 'Table'[Month] & " 2022" ) RETURN CALCULATE ( SUM ( 'Table'[2022] ), DATEVALUE ( "1 " & 'Table'[Month] & " 2022" ) <= CurrentMonth, ALLEXCEPT ( 'Table', 'Table'[Business Area] ) )YTD-2021 = VAR CurrentMonth = DATEVALUE ( "1 " & 'Table'[Month] & " 2021" ) RETURN CALCULATE ( SUM ( 'Table'[2021] ), DATEVALUE ( "1 " & 'Table'[Month] & " 2021" ) <= CurrentMonth, ALLEXCEPT ( 'Table', 'Table'[Business Area] ) ) - Hariharan_R
Solution Sage
Refer the attached PBIX file.
2021 YTD = CALCULATE(TOTALYTD(SUM('Table'[Qty]),'Date'[Date]),'Table'[Year]=2021)Thanks
Hari
Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.