Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Time Functions

Hi, amitchandak Ashish_Mathur  I have data Amount and Date in a table and wanted to calculate some time functions. I dont want to use any calendar table here. I derived Year and Month from the date...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Please try:

    Last Year Same Month = 
    CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table'[Date].[Year])-1 && MONTH([Date])=MAX('Table'[Date].[MonthNo])))
    FY = IF(MONTH(MAX('Table'[Date]))<4, YEAR(MAX('Table'[Date]))-1 , YEAR(MAX('Table'[Date])) )
    FY Sum = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY]))) 
    Last Year YTD = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY])-1))

     


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