Forum Discussion

ngiom's avatar
ngiom
Frequent Visitor
5 years ago
Solved

Static values in a graph

Hi there, I am trying to show a graph with static values and dynamic values adjusted by a slider int he same graph. The image below has sample data showing the static 28 days and dynamic episodes. ...
  • ngiom's avatar
    ngiom
    5 years ago

    Hi amitchandak,

    I figured it out. I created a second date table using the calendar(min(date[date]), max(date[date])) of the first table. Then created a last date field in the new date table using the TODAY() function. I then used the last date on the two measures above to make them static. Finally i used the second date table as the slide filter, see adjusted caculated fields.

     

    Static fields:

    12 weeks =
    var _max = maxx(ALLSELECTED('Date2'),'Date2'[LastDate])
    var _min = maxx(ALLSELECTED('Date2'),'Date2'[LastDate]) - 12*7
    return
    calculate([Episodes], filter(Date, Date[Date] >=Min && 'Date'[Date] <=Max ))


    28 Days =
    var _max = maxx(ALLSELECTED('Date2'),'Date2'[LastDate])
    var _min = MAxx(ALLSELECTED('Date2'),'Date2'[LastDate]) - 28
    return
    calculate([Episodes], filter(Date, Date[Date] >=Min && 'Date'[Date] <=Max ))

     

    Dynamic field:

    Episodes =
    var _max = maxx(ALLSELECTED('Date2'),'Date2'[Date])
    var _min = Minx(ALLSELECTED('Date2'),'Date2'[Date]) 
    return
    calculate([Episodes], filter(Date, Date[Date] >=Min && 'Date'[Date] <=Max ))

     

    Thanks for the initial idea of the two measures.

    N