Forum Discussion

jshinnenkamp's avatar
jshinnenkamp
Frequent Visitor
8 years ago
Solved

Editing contant lines based on dates

 

 

I have this chart with a constant line at 4. The chart is using relative date filtering so 2018 months will come into the chart as they occur. I would like to be able to change the constant value in 2018 to 4.5, but have it remain at 4 for 2017. Not sure this is possible, a different way to maybe go about it is using a chart with a line value and maybe use a 4 and 4.5 from a field within the data tables.

 

Thanks for the help.

  • Greg_Deckler's avatar
    Greg_Deckler
    8 years ago

    Sorry, my bad, wrap your YEAR() in a MAX function. It's a measure, so you need to do some kind of aggregation.

     

    Measure = IF(MAX(YEAR(Table[Date]))<2018,4,4.5)

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    I would go with a combination line/column chart and use a measure for the line like:

     

    Measure = IF(YEAR(Table[Date])<2018,4,4.5)
    • jshinnenkamp's avatar
      jshinnenkamp
      Frequent Visitor

      The issue with that is my date column has multiple values so it gives me an error. I think I'd need to return a column that returns a 4.5 for the first entry in 2018 and blank in the rest of 2018 values. Similarly return a 4 for the first non 2018 date and the rest blanks. Any ideas?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Sorry, my bad, wrap your YEAR() in a MAX function. It's a measure, so you need to do some kind of aggregation.

         

        Measure = IF(MAX(YEAR(Table[Date]))<2018,4,4.5)