Forum Discussion

maxduff59's avatar
maxduff59
Helper II
4 years ago
Solved

Plot a graph between two dates

I created two measures which contain : the date of the day and the date of x days before today (x chosen with a slicer).
I would like to plot a graph with some dates on x-axis and numeric values on y-axis.

Do you have an idea how could I filter my axis between my two dates measures ? 

Thanks in advance for your help and your time

  • maxduff59 if you will create a measure like:
    MEASURE = 
    VAR _x_days_before_date = [Your Date x days before Measure]
    VAR _date =  [your the date of the day Measure]
    RETURN
    CALCULATE([Your value], DATESBETWEEN('Date Table'[Date], _x_days_before_date,  _date] 

    You would get the y values only for those dates, everything outside will be blank and not presented on the chart and axis will start from your desired start to end.






          

    Showcase Report – Contoso By SpartaBI

5 Replies

  • SpartaBI's avatar
    SpartaBI
    Community Champion

    maxduff59 if you will create a measure like:
    MEASURE = 
    VAR _x_days_before_date = [Your Date x days before Measure]
    VAR _date =  [your the date of the day Measure]
    RETURN
    CALCULATE([Your value], DATESBETWEEN('Date Table'[Date], _x_days_before_date,  _date] 

    You would get the y values only for those dates, everything outside will be blank and not presented on the chart and axis will start from your desired start to end.






          

    Showcase Report – Contoso By SpartaBI

    • maxduff59's avatar
      maxduff59
      Helper II

      I will try that, thank you. I just have a little question, why do I need to redefine my date measures through variables ?
      Moreover, what is the first term of the CALCULATE function [YOUR VALUE] ?