Forum Discussion

yamina's avatar
yamina
Helper I
2 years ago
Solved

dax problem

Hello    Can you help me to solve this issu please ?  In the card I want to show the result of the previous year in the same period YTD n-1 51246  And the details show this   
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi yamina ,

    First of all I think the SAMEPERIODLASTYEAR function requires the Date data type, which is the reason for the wrong result you reported.

    I create a table as you mentioned and make it as a matrix.

    Then I create a measure and here is the DAX code you can refer.

    YTD n-1 = 
    CALCULATE(SUM('Table'[Total]), 'Table'[Year] = 2023)

     

     

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.