Forum Discussion

STEPH0018's avatar
STEPH0018
Helper II
5 years ago

Auxiliary dCalendar

Hi, guys, I need to create an auxiliary dcalendar to use in a line graph only the date from the range of the date selected by the user.

 

 

In the case of the chart above, I would like to show the data from 12/31/2019, the last day of the year before the selected date, until 01/06/2020, which is the selected date. When I try to create a range using datesbetwenn it doesn't understand the range. Is it possible to do this with dax?

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    STEPH0018 So, you would want your calendar table disconnected from your slicer and then you could do this:

    Measure =
      VAR __MaxDate = SELECTEDVALUE('Slicer'[Date])
      VAR __MinDate = DATE(YEAR(__MaxDate)-1,12,31)
      VAR __CurrentDate = MAX('DateAxisTable'[Date])
    RETURN
      IF(__CurrentDate >= __MinDate && __CurrentDate <= __MaxDate,[your measure to display],BLANK())
    • STEPH0018's avatar
      STEPH0018
      Helper II

      I, Greg, so I would like to make the change only to the graph, not the measure. A filter in the visual to show just before the user-selected date until the last day of the previous year, measurement values ​​do not change. But quaht would be the 'Slicer'[Date]?

    • STEPH0018's avatar
      STEPH0018
      Helper II


      The idea would be how to put the two dates here automatically: