Forum Discussion

bipowerbix's avatar
bipowerbix
Icon for Helper I rankHelper I
3 years ago
Solved

YTD MEASURE NOT WORKING AS INTENDED

Here is the Table named test:   Here is the table 2 which contains Dates, which is used as Slicer:   Dates = CALENDAR(date(2022,1,1),TODAY())     Link between Dates and test dataset: ...
  • PawarNovil's avatar
    3 years ago

     

    Hi bipowerbix 

     

    I got the desired result, please try the below measure.

    -------------------------------------------------------

     

    YTD =
    VAR minim = CALCULATE( MIN( Dates[Date]), ALLSELECTED(Dates[Date])) //12-10-2022
    var startyear = DATE(YEAR(TODAY()),1,1) // current start year date 1-1-2023
    var a= if( minim >= startyear ,
    calculate(sum(test[Totals] ), FILTER(all(Dates), Dates[Date] >= startyear))  ,  
     calculate(sum(test[Totals] ), FILTER(all(Dates), Dates[Date] >= startyear))
     
      )
     return a

    -------------------------------------------------

     

    --------------------------------------------------------------------------

    Regards,

    Novil

    If I answer your question, please mark my post as a solution.