Forum Discussion

priyapalanki's avatar
priyapalanki
Frequent Visitor
9 years ago
Solved

Comparing previous and current year data on a line chart

Hi   I want to compare the daily trend for FY 16 ( Jul 1st 2015 to June 30th 2016) and FY17( July 1st 2016 to June 30th 2017) on a line chart in two graphs ,  on the x-axis I want to see only the m...
  • tringuyenminh92's avatar
    tringuyenminh92
    9 years ago

    Hi priyapalanki,

     

    if you have 2 separate tables FY16 and FY17, it's easy now.

     

    Dates = CALENDARAUTO()

     

    • Create Prev-Date Column
    Prev - Date = DATEADD( Dates[Date],-1,YEAR)

     

    • Union 2 separate tables FY16 -FY17 into 1 table: 
    u = UNION(FY16,FY17)
    • Create 2 calculated measure to cumpute total amount of FY16 and FY17:
    FY16 = CALCULATE(SUM(u[Amount]),FILTER(all(dates),Dates[Date]=MAX(Dates[Prev - Date]) ))
    FY17 = CALCULATE(SUM(u[Amount]),FILTER(all(dates),[FY16]>0 && Dates[Date]=max(Dates[Date])  ))

     

     

     

    My sample data and sample pbix file

     

     

    If this works for you please accept it as solution and also like to give KUDOS.

    Best regards
    Tri Nguyen