Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
G3N3XT
Frequent Visitor

Target line on primary Y-axis in combo chart

Hi all, 

 

I would like to add a target line (constant horizontal line) on the primary Y-axis on a combo (line and stacked column) chart without sacrificing the secondary y-axis (which has a different scale). How can I do this?  Analytics pane doesn't provide me any features and adding a measure to the line value only gives me a line on the secondary y-axis (which needs to have a completely different scale from the primary y-axis). 

So to clearify things: how do I add a red line like in the image below on the 80% value of the primary (left) Y-axis?

Combo chart with target on primary Y axis.JPG

 

Thanks in advance!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@G3N3XT your understanding is absolutely correct.  We cannot dynamically set the min and max values. This was just a workaround as I cannot think of anything else. You can tweak the logic as you see fit. I think in the case of auto, it scales to the nearest rounded number, never paid much attention but again it is a workaround, and hope it works out for you, but yes if the scale changed, it will break. Good luck!

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@G3N3XT I think there is an idea on the ideas forum, don't have the link handy but if you search for it, you should vote for it.

 

Cheers!!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@G3N3XT your understanding is absolutely correct.  We cannot dynamically set the min and max values. This was just a workaround as I cannot think of anything else. You can tweak the logic as you see fit. I think in the case of auto, it scales to the nearest rounded number, never paid much attention but again it is a workaround, and hope it works out for you, but yes if the scale changed, it will break. Good luck!

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks! Would be a lot easier if we could use a variable/measure as min/max on the y-axis scale, but so be it 😄

parry2k
Super User
Super User

@G3N3XT add the following measure and then put it on line value section

 

80% Value = 
VAR __max = MAXX ( ALL ( Blad1[Year] ), [Secondary_value] )
VAR __len = LEN ( FIXED ( __max, 0, TRUE() ) )
VAR __subtract = VALUE ( "1" & REPT ( "0", __len - 1 ) )
VAR __result = ROUNDUP ( __max , ( __len - 1 ) * -1 ) - __subtract
RETURN __result

 

parry2k_0-1612630472203.png

 

output

 

parry2k_1-1612630499859.png

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts 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.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi Parry, Thanks for the answer so far! So I understand the way to go is to create an additionel line on the secondary axis using DAX, such that it gets calculated on the 80% value of the primary axis artificially. The measure now only breaks down in case of using a different secondary axis scale then "auto" (which will be required later on). When you have the min/max axis scale set to "auto", does it always evaluate to the nearest rounded number (e.g. nearest thousand above/below max/min value in case of thousands in the data)? 

Is there any way to set the y-axis min/max values to a variable/measure instead of either a hard-coded number or "auto"?

parry2k
Super User
Super User

@G3N3XT I think I have an idea not sure it will work or not, can you share a sample pbix file thru one drive/google drive and remove any sensitive information before sharing it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi parry2k, 

 

I've made some sample data and a sample pbix file. Both can be found using this dropbox link: https://www.dropbox.com/sh/i2qofwxvobqw5vc/AAAql01yGBO0HAJGVO2OkoVha?dl=0 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.