Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I need to select specific points in line charts, and the data labels should be applied only to those points, rather than randomly choosing maximum and minimum inflection points on the graph.
Any ideas or suggestions would be greatly appreciated.
Solved! Go to Solution.
Hi, @Jai_94
You can format the Date/Time field, then create the Slicer table and add the Measure that belongs to each line.
Date and Time(no second) = FORMAT([Date and Time], "MM/DD/YYYY hh:mm:00 AM/PM")
Slicer = VALUES('Table'[Date and Time(no second)])
DataLabel Flag A =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[A] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag B =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[B] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag C =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[C] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag D =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[D] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @Jai_94
Thanks for Ritaf1983's reply. Currently there is no direct support for this feature, but here is a workaround that will do what you need.
DataLabel Flag =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Test] IN VALUES ( 'Table'[Test] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[Value] )
VAR _result =
IF ( ISFILTERED ( Slicer[Test] ), IF ( _flag = 1, _value ) )
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
thanks for your reply.
so I have a line chart as shown below, if i need to specific datalabels let's say for 2:03 AM( i would need to show data labels for all the lines at that time) , how should i do it ?
your help would be appreciated.
thanks
Hi, @Jai_94
In order to clarify your needs, you can provide a pbix file without sensitive data and the desired effect to be achieved to help use it for testing.
Best Regards,
Yang
Community Support Team
I cannot send the PBIX file through this post but you create a raw data based on the below criteria.
five headers
1. timestamp : 22/1/2025 2:02:00 to 22/1/2025 2:07:00 ( intervals per second) you will have about 301 rows.
2. A : 7500 - for all rows
3.B : 0 - for all rows
4.C : 0- for all rows
5.D :350- for all rows
header:Timestamp is X-axis
Header: A & B is primary Y-axis
Header: C & D is secondary Y-axis
let me know if you have questions.
Hi, @Jai_94
You can format the Date/Time field, then create the Slicer table and add the Measure that belongs to each line.
Date and Time(no second) = FORMAT([Date and Time], "MM/DD/YYYY hh:mm:00 AM/PM")
Slicer = VALUES('Table'[Date and Time(no second)])
DataLabel Flag A =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[A] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag B =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[B] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag C =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[C] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
DataLabel Flag D =
VAR _flag =
CALCULATE (
IF (
COUNTROWS ( FILTER ( Slicer, Slicer[Date and Time(no second)] IN VALUES ( 'Table'[Date and Time(no second)] ) ) ) > 0,
1,
0
),
ALLSELECTED ( Slicer )
)
VAR _value =
SELECTEDVALUE ( 'Table'[D] )
VAR _result =
IF ( ISFILTERED ( Slicer[Date and Time(no second)] ), IF ( _flag = 1, _value ) )
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
is the data label based on slicer selection?
Hi @Jai_94
If the selection is from the same graph where you want to highlight the selected points, and not a filter from another visualization, unfortunately, this option is not available.
There is an idea about similar issue in scatter plot, you can add there your idea as a note / suggest new one
https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=7aeea97b-c795-43d3-a1a8-14d0e0712b1f
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
120 | |
74 | |
72 | |
58 | |
48 |
User | Count |
---|---|
167 | |
83 | |
68 | |
66 | |
55 |