Forum Discussion

sharong's avatar
sharong
Icon for Helper I rankHelper I
3 years ago

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 

 

 

 

5 Replies

  • visheshjain's avatar
    visheshjain
    Icon for Impactful Individual rankImpactful 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

      • visheshjain's avatar
        visheshjain
        Icon for Impactful Individual rankImpactful 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"
        )

         

        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