Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

YTD Based on slicer

Hi,

I would like to show YTD figure on the report based on month slicer. So if I choose Septemer from the Month slicer, the table will give me YTD figure from Jan-Sep, if I choose August from the month slicer, the table will give me YTD figure from Jan-Aug. Currently, no matter which month that I select from the month slicer, the Actual YTD will show Jan-current month, as there is no data available for future month, which is 796,349.

 

The measure that I am using now for Actual YTD is: 

Actual YTD = CALCULATE(TOTALYTD([Actual],'GL Jan-Sep AU'[Posting Date]),ALLEXCEPT(YMD,YMD[YMD].[Date]))
 
Thank you.

4 Replies

  • Check if this can work for you

    Sales YTD on LYTD = 
    Var   _start_date=(minx('Date',STARTOFYEAR('Date'[Date]))) 
    Var   _end_date=(max('Date'[Date]))
    
    Var _last_year_mtd_val= CALCULATE(sum(Sales[Sales Amount]),Sales[Sales Date] >= _start_date && (Sales[Sales Date]) <= _end_date,filter(Sales,COUNTROWS(SAMEPERIODLASTYEAR(Sales[Sales Date]))>0))
    return
    _last_year_mtd_val

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
    Thanks.

  • vblbiservice's avatar
    vblbiservice
    Frequent Visitor

    Dear Team,

     

    Do you have power bi file to solve this issue. I am facing this issue too. Much appreciated if team can help.

     

    Thanks!

    Aynar

    • Ashish_Mathur's avatar
      Ashish_Mathur
      Icon for Super User rankSuper User

      Hi,

      Share some data, explain the question and show the expected result.