Forum Discussion

anupampandey's avatar
anupampandey
Icon for Helper III rankHelper III
9 years ago

DAX - Running Total YTD

Hi,

 

I am calculating the MTD and YTD for which I have used below statements.

 

MTDValue = TOTALMTD(SUM(RetailerSummary[Tran_Amount]),RetailerSummary[Transaction Date])

& for 

YTDValue = 

VAR RowDate = RetailerSummary[Transaction Date]

RETURN CALCULATE (SUM(RetailerSummary[Tran_Amount]),
FILTER(RetailerSummary,RetailerSummary[Transaction Date]<=RowDate

&&  

YEAR(RetailerSummary[Transaction Date] = YEAR(RowDate))

))

 

The issue I am facing in YTD is that it calculate YTD value instead of FiscalYTD.

Also on "Visual level filters" I am taking the max of YTD value. Is this method correct or not? Right now I am getting the correct values (YTD and not fiscal YTD)

 

Could anyone please help me to fix this issue?

 

Thanks,

Anupam

16 Replies

  • PavelR's avatar
    PavelR
    Icon for Solution Specialist rankSolution Specialist

    anupampandey I would suggest to use DATESYTD function in CALCULATE function and use the second parameter of DATESYTD that defines year end date.

     

    Regards.

    Pavel

    • anupampandey's avatar
      anupampandey
      Icon for Helper III rankHelper III

      can you please provide me the syntax for the same?

       

      Thanks,

      Anupam

      • PavelR's avatar
        PavelR
        Icon for Solution Specialist rankSolution Specialist
        YTD_fiscal = CALCULATE(SUM(Transactions[Value]);DATESYTD('Date'[Date];"06-30"))

         

        Put your columns in formula.

         

        Regards.

        Pavel