Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

YTD graph until selected month

Hi,   I could really use your help with the following measure.   I made a graph showing the total sales up to the selected month. So if I select Dec 2018, I see jan -  dec 2018. If I select jan...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous,

    Please create a new date table using dax below. Please note that there is no relationship between the new date table and other table.

    Calendar = CALENDARAUTO()

     

    Then create the following measures in your table.

    YTD = TOTALYTD([Total Turnover MSCI];'Date'[Date])
    NewMeasure= var Ldate = MAX('Calendar'[Date])//Last date
    
    return
    
             if(min('Date'[Date])<=Ldate;
                       [YTD])


    At last, use date field of the new date table('Calendar'[Date]) to create slicer, create a line chart using 'Date'[Date] field and NewMeasure.

    Regards,
    Lydia