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
Hoping
Helper II
Helper II

Line Chart with two constant Lines one for each legend category

I have a line chart drawn with a Year on the X-axis and a Measure on the Y-axis.

 

Aditionally, I have a field in the legend which give me 2 lines one for each category in the legend field.

 

Now I want to be able to display 2 constant lines one for each category.  When I use the Analytics pane, I am able to add only one field - Measure and so I am able to show just one constant line.

 

Is there a way to display 2 constant lines based on the legend field ?

 

 

5 REPLIES 5
Ritaf1983
Super User
Super User

Hi @Hoping 
You can add multiple constants, just press "Add line" for every new line that you need.

Ritaf1983_0-1699759937596.png

pbix is attached.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

The contant line I would like to display is the current year value for each category (the column in the legend).

 

I want 2 lines one for each category.

 

Should I be creating 2 measures one for each category ?

 

 

Hi @Hoping 
Technically - yes.
From an Efficient data visualization perspective, I don't recommend putting all this on 1 graph...
If I understood you correctly the result is 6 lines on the same graph ( 2 measures + 2 constants for every separate measure) it will be very challenging to read this kind of graph.
Maybe it will be better to create 2 separate graphs ...or to create the tooltip with the constants.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

That will be 4 lines - One line for each of the 2 categories plus 2 constant lines one for each category.

This is not just about the quantity of lines; having two lines with two constants is akin to telling two stories in one sentence. When comparing two trends or categories in a chart, introducing constants can create confusion for the reader. It requires additional cognitive effort to discern which constant corresponds to each measure, diverting the reader's mental resources from the primary task of comparing trends. Regardless, the decision is yours. Technically, the answer is yes—having separate measures for each constant, just like in the Power BI file I attached in my initial response.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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