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, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Mateja
Helper II
Helper II

Show starting and ending data label for line charts

Hi everyone 

 

I have line graphs on my Dahboard where only start and end data labels are shown using two measures:

LTA max LABEL = var _max =maxx(ALLSELECTED(D_Date),D_Date[Date])
return
CALCULATE([LTAF L12M],FILTER(Filterdate, Filterdate[Date]=_max))
 
LTA min LABEL =
VAR _min = MAXX(ALLSELECTED(D_Date), D_Date[11MBef])
return
CALCULATE([LTAF L12M],FILTER(Filterdate,  Filterdate[Date]=_min ))
Mateja_1-1678181522441.png

 

 
I have a helping calendar so I can show rolling 12 values based on the filter context of the main calendar:
Mateja_0-1678181469348.png


D_date is the main calendar, FilterCalendar is used for visuals.

 

The problem I have is if the graph does not show all the 12 month because no data is present then the data labels do not appear.

Mateja_3-1678181601989.png

 

 

How can I make these measures dynamical so they always point at the two available data point at the start and end?

For example on the graph you can see that 3/22 has a data label but the 9/22 does not because in the filter context 2/2023 was chosen as a month. So if the graph showed 2/23 the data label for that data point would be available. 

Thank you!

2 REPLIES 2
amitchandak
Super User
Super User

@Mateja ,

Reason one -> You are using a continuous axis, it skips periods to adjust. Use a categorical axis if needed 

 

Axis_type.png

 

if need use a measure like this with the categorical axis

0 between range
Measure = var _1= SUM(Opportunity[Opportunity count]) +0
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak

 

Thank you for your fast answer!

Unfortunately, I cannot use the categorical axis because  every month label needs to visible. Also the graphs are quite small so the M/YY works great for the visualisation.

I incorporated your solution and it works.

LTA label2 =
var _1= ([LTAF L12M2]) +0
var _min = minx(ALLSELECTED(D_Date), D_Date[Date])
var _max = maxx(ALLSELECTED(D_Date), D_Date[Date])
return
CALCULATE(if(max(FilterDate[Date]) <_min || max(FilterDate[Date]) >_max , BLANK(), _1))


It shows the value for the month in the filter context even if there are no values 

Mateja_0-1678184866827.png

The problem is it only shows data label for the max value or the month that is in the filter context as seen on the picture. So it does not show the minimum value represented on the graph
Can you maybe help with this?

Note, I use a helping calendar to show rolling 12 values  when there is only one month selected in the filter context. 

So to be clear is it possible to develop a measure that would always put data labels at the start and end values so on the graph above for 2/22 and 9/22?

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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