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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Brummitt5043
New Member

Please Help - How do I create a graph with data labels on line ends?

Hi,

 

New to power bi, currently transfering a number of reports from one system to another. How do i add data labels to line ends on power BI? I've used similar visualisation tools and this is usually an easy feature to add to a visualisation.

 

An example of what my graph looks like is below:

Brummitt5043_0-1665654695863.png

 

Thanks!

 

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Here are a couple of options to complement the suggestions provided.

If you add a legend, currently you cannot add more than one measure as values (which you need currently to show the labels for the max month value by year - though I think I've seen this feature demoed in conferences for future releases).

So the options are:

1) Create measure for each of the values per year and add them to the y-axis values. The measures follow this pattern:

 

Sales Current Year = 
CALCULATE([Sum sales], 'Date Table'[Year] = YEAR(TODAY()))

 

and 

 

Max month PY Year = 
VAR _MXmonth = CALCULATE(MAX('Date Table'[Month]), FILTER(ALL('Date Table'), NOT ISBLANK([Sum sales]) && 'Date Table'[Year] = YEAR(TODAY())-1))
RETURN
CALCULATE([Sum sales], FILTER('Date Table', 'Date Table'[Month] = _MXMonth && 'Date Table'[Year] = YEAR(TODAY())-1))

 

You can now add all the measures to the y-axis bucket, and format each measure to show the corresponding colour

Standar line chart.png

Two caveats here:

- Since the measure names aren't dynamic, you are stuck with whichever name you give them (so not future proof)

- The visual will not fully respond to a slicer

standard gif.gif

 

2) Create a fields parameter table with all the measures to use in the visual. Add a Year field to this table.

fileds parameter.pngparam year.png

Create a new table including the periods and the colour codes:

legend table.png

Create a one-to-many relationship between the year field in this legend table and the year field in the parameter table. The model looks like this:model.png

Create the line visual with the measure from the parameter field table and format each measure using the codes from the legend table. Turn on the data labels only for the max month by year values.

Create a matrix visual with the fields from the Legend table: Year as columns; year as values.

create legend.png Hide the header by turning the tex to the same colour as the visual; format (conditional) the year values referencing the codes in the legend table. Overlay (if you wish) the legend over the visual (turn off the legend on the visual). Make sure that "maintain layer order" is set to on under the formatting pane -> general

layer order.png

If you need to slice by year, create a new dimension table for Year as a bridge table and create the relatiohsips between this Year Table and the Legend and Date table:

Year Table.png

 

 

 

and you will get

Year Slicer.gif

 

Sample PBIX attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

7 REPLIES 7
PaulDBrown
Community Champion
Community Champion

Here are a couple of options to complement the suggestions provided.

If you add a legend, currently you cannot add more than one measure as values (which you need currently to show the labels for the max month value by year - though I think I've seen this feature demoed in conferences for future releases).

So the options are:

1) Create measure for each of the values per year and add them to the y-axis values. The measures follow this pattern:

 

Sales Current Year = 
CALCULATE([Sum sales], 'Date Table'[Year] = YEAR(TODAY()))

 

and 

 

Max month PY Year = 
VAR _MXmonth = CALCULATE(MAX('Date Table'[Month]), FILTER(ALL('Date Table'), NOT ISBLANK([Sum sales]) && 'Date Table'[Year] = YEAR(TODAY())-1))
RETURN
CALCULATE([Sum sales], FILTER('Date Table', 'Date Table'[Month] = _MXMonth && 'Date Table'[Year] = YEAR(TODAY())-1))

 

You can now add all the measures to the y-axis bucket, and format each measure to show the corresponding colour

Standar line chart.png

Two caveats here:

- Since the measure names aren't dynamic, you are stuck with whichever name you give them (so not future proof)

- The visual will not fully respond to a slicer

standard gif.gif

 

2) Create a fields parameter table with all the measures to use in the visual. Add a Year field to this table.

fileds parameter.pngparam year.png

Create a new table including the periods and the colour codes:

legend table.png

Create a one-to-many relationship between the year field in this legend table and the year field in the parameter table. The model looks like this:model.png

Create the line visual with the measure from the parameter field table and format each measure using the codes from the legend table. Turn on the data labels only for the max month by year values.

Create a matrix visual with the fields from the Legend table: Year as columns; year as values.

create legend.png Hide the header by turning the tex to the same colour as the visual; format (conditional) the year values referencing the codes in the legend table. Overlay (if you wish) the legend over the visual (turn off the legend on the visual). Make sure that "maintain layer order" is set to on under the formatting pane -> general

layer order.png

If you need to slice by year, create a new dimension table for Year as a bridge table and create the relatiohsips between this Year Table and the Legend and Date table:

Year Table.png

 

 

 

and you will get

Year Slicer.gif

 

Sample PBIX attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Brummitt5043
New Member

Hi, Cheers for the quick response.

 

The issue i have with this is that i have two choices in the data labels section. I have to either have all the data labels on or none for each line. I want just data label ends for each line and there is no option for this?

Brummitt5043_0-1665655737038.png

 

Brummitt5043_1-1665655762625.png

 




Hi,

I think you are seeing Data labels option.

Please try to find Series labels  option.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi,

 

Again, thanks for the quick response!

I've used the series labels however this shows which financial year each line is rather than the value of the last point:

 

Brummitt5043_0-1665660938278.png

Brummitt5043_1-1665660964649.png

 

I'm looking to add the first and last value for each financial year.

Hi,

Please share your sample pbix file's link, and then I can try to look into it to come up with a more accurate solution.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Jihwan_Kim
Super User
Super User

Hi,

Under the Format visual pane, try to find Series labels feature, and turn it on.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Anonymous
Not applicable

Hi,

Use the visualization panel like on this example

JamesFr06_0-1665655395014.png

 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 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.

October NL Carousel

Fabric Community Update - October 2024

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