Forum Discussion

PowerRocky12's avatar
PowerRocky12
Icon for Helper I rankHelper I
4 years ago

YTD Slicer

Hello,

 

I am trying to create a YTD and full year Slicer for my report. In most of my charts its a 5 year comparision so I would want this slicer to work not just for the current year but everything on my report. So if I chose YTD slicer, it would filter all5 fiscal years based on todays date in the fiscal year. My fiscal year starts April 1st so I would have to take this into account to.

 

I have looked at a few posts but I can't see anything that will help me. If anyone could share some ways I can do this or some links I would appricate it.

 

Thank you

3 Replies

  • PowerRocky12 , Try like

    YTD QTY forced=
    var _max = today()
    return
    if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
    //or
    //calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
    //calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))

     

    last two Comments are alternatives that can be used

    • PowerRocky12's avatar
      PowerRocky12
      Icon for Helper I rankHelper I

      Hey, how will this help me create a slicer for my report though? I want a slicer that has "YTD" and "Full Year" Options.

  • I would suggest you do the following

     

    - First create a the DAX calculation that gives your the desired result for YTD and FY

    - Create Calculation groups using the DAX calculation

    - Use the calculation groups as slicers

     

    Nishant