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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sharong
Helper I
Helper I

Text measure as legend in scatter plot

I am creating a scatter plot with X axis and Y axis are direct columns from the table. In “Values”, I have customer name and customer number. For the legend, I have a calculated measure “persistence” based on selected value of two parameters. Can anyone help on how to use this measure as a legend in scatter plot? This can be done easily in tableau but dont know how to implement in Power BI. But there might be some way to do this. Kindly help me as it is a common use case and can be useful to power bi developers.

Below are the two measures used:

long term = SWITCH(TRUE(),

            MIN(table[DL_LT]) <= SELECTEDVALUE(‘lower threshold'[lower threshold]), 1,

MIN(table[DL_LT]) >= SELECTEDVALUE('lower threshold'[lower threshold]), 3, 2)

 

persistence = SWITCH(TRUE(),

                             [long term] = [short term], "didn't change",

                            [long term] > [short term],  “improved",

                           [long term] < [short term], "worse")

Thanks in advance for any help @Mikelytics @visheshjain @Greg_Deckler @amitchandak @Jihwan_Kim 

 

 

sharong_0-1670404453590.png

 

5 REPLIES 5
visheshjain
Impactful Individual
Impactful Individual

Hi @sharong,

 

As far as I know you can only use a column in the legends field, so a measure will not work.

Maybe having a dis-jointed table witth your possible measure results MIGHT work, but I am not too sure the approach will work.

 

Please can you share a PBIX, I'd like to take a dig at it.

 

Thank you,

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Hi @visheshjain 

Thank you so much for your instant response. I am attaching the pbix file below. Please let me know on the update of this measure as legend if you find the solution or workaround. Thank you.  

https://drive.google.com/file/d/18kNyC0aVSnlWf4C72AVJ2ZBBY6npw2B_/view?usp=sharing 

visheshjain
Impactful Individual
Impactful Individual

Hi @sharong,

 

I took a quick look at it and wasn't able to get the exact solution to your problem.

 

However, conditional formatting kinda worked, but still won't show text.

Here is a version of your measure that I used for the conditional formatting of the data points.

Persistence Color =
SWITCH (
    TRUE (),
    [long term (only)] < [short term (only)], "Red",
    [long term (only)] > [short term (only)], "Green",
    "Yellow"
)
visheshjain_0-1670415765748.png

 

Since your upper and lower thresholds are dynamic, we can't even create a calculated column.

I haven't tried the dis-jointed table method yet but will try it tomorrow probably.

 

Thank you,

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Thanks for the update @visheshjain please do try dis-jointed table method and let me know if it works better than this conditional formatting method. This conditional formatting of data points satisfies the requirement. I have included 

"Payment delay persistence only short" into the tooltips of scatter plot and now text shows up in tooltip. But I also want to bring it as a slicer. Is there any way to bring this as a slicer also.
Thanks in advance for your kind help. Grateful!
visheshjain
Impactful Individual
Impactful Individual

Hi @sharong,

*****EDIT****

Just thought of something, that we can use Query parameters and probably create a calculated column based on that.

This way you lose a little bit of flexibility of the slicer and the report will need to be refreshed, but it just might work the way you want it to. So there is a trade-off.

I need the source excel file aka Sheet1 of your data to make changes to the query, so please share that or a sample file if possible.

 

*****Edit Over****

 

I gave it a shot but couldn't get anything to work exactly the way you would have wanted.

 

Since it is a scatter plot and it accepts only columns, nothing worked.

I also tried to go the Calculation Group route, but didn't work.

 

Sorry couldn't be of much help here and you are more than welcome to accept one of your own responses as the solution to this post.

 

Thank you,

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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