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

The 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.

Reply
Jai_94
Frequent Visitor

How to pick points for the datalabels in line chart ?

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.

1 ACCEPTED 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.

vyaningymsft_0-1737605432584.png

 

 

 

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

View solution in original post

7 REPLIES 7
v-yaningy-msft
Community Support
Community Support

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.

vyaningymsft_2-1737524449538.png

 

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 ?

Jai_94_0-1737529518422.png

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.

vyaningymsft_0-1737605432584.png

 

 

 

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?

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

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.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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