Forum Discussion

amcd325's avatar
amcd325
New Member
4 years ago

Stepped Trend Line - Is it possible?

Is there anyway to make a "Trend" line or a "Y-Axis Constant" line into a stepped line? I have a request to have the trend line sit at 20% until a specific month and then drop to 10% moving forward. I'm still learning Power BI, but haven't found a solution to this or a similar issue to reference. Thank you for your help!

6 Replies

  • amcd325 create a measure for the trend line, tweak the logic as you see fit.

     

    Trend Line Measure = 
    IF ( MAX ( Table[Month Number ) > 8, .1, .2 )

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

  • parry2k sorry to ask, but how would I apply this? I've tried putting it in a bunch of the fields, but keep getting an error. Maybe I did the measure wrong - I did get it created successfully doing it this way. I haven't gotten to the DAX part of my training yet lol. I appreciate your help and patience.

    Template:
    Trend Line Measure = 
    IF ( MAX ( Table[Month Number ) > 8, .1, .2 )
    
    Our Info:
    Y-Axis Constant Line Measure = 
    IF (MAX(DT_TBL[Year_Month]) > 7, .1)

     

  • amcd325 what is year_month table looks like in your table? Seems like it is a text. Can you confirm? Also after you created this new measure, did you use it in any of the visuals? If yes, did you get any errors?

    • amcd325's avatar
      amcd325
      New Member

      I see now that Month Number is an actual option here so I have changed the string to:
      IF (MAX( DT_TBL[MTH_NBR] >7, .1)
      This string like this works in the file (Thank you!)

      I would like to put it in the line graph as either the Y Constant or a secondary Y axis. I'm not sure making it a Y Constant is a possibility, but when I put it in Secondary Y axis field, it makes all of my lines go flat. 😞

  • amcd325 can you share the pbix file, and remove sensitive information before sharing? It is a bit hard to tell why it is not working.

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi amcd325 ,

    Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

    Best Regards
    Lucien