Forum Discussion

PowerBI-Newbie's avatar
2 years ago
Solved

Maximum value from a measure based on legend

Hi,

I'm trying to work out the maximum value from a measure based on the Year:Period and use this as the maximum Y-Axis. Based on the following measure which I got from a YouTube video, I'm able to get the maximum Y-Axis value (962 x 1.1=1.06k) based on the Year:Period column in my table:

Measure:

MaxChart All Faults Count - All = 
CALCULATE(
    MAXX(
        ADDCOLUMNS(DISTINCT(ALL(Issues[Year:Period])),"AllCount",[All Faults Count - All]),[AllCount])*1.1,
        All(Issues[Status])
)

 

Screenshot:

 

 

But as soon as I add a legend I don't know how to update the measure to get the maximum based on the Status column across all Year:Period. From the screenshot below the maximum Y-Axis should read 716.1 (561 x 1.1).

 

Any help is greatly appreciated.

  • Hi PowerBI-Newbie -Can you try below measure with slight adjustments

     

    MaxChart All Faults Count - All with Status =
    CALCULATE(
    MAXX(
    ADDCOLUMNS(
    SUMMARIZE(ALL(Issues), Issues[Year:Period], Issues[Status]),
    "AllCount", [All Faults Count - All]
    ),
    [AllCount]
    ) * 1.1,
    REMOVEFILTERS(Issues[Status])
    )

     

    this measure should adjust dynamically based on the maximum fault count for each combination

    Hope it works

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

     

     

  • PowerBI-Newbie's avatar
    PowerBI-Newbie
    2 years ago

    Hi rajendraongole1 ,

    I ended up having a play before you responded and found that I can do the following which also worked:

    MaxChart All Faults Count - All = 
    CALCULATE(
        MAXX(
            ADDCOLUMNS(DISTINCT(ALL(Issues[Year:Period],Issues[Status])),"AllCount",[All Faults Count - All]),[AllCount])*1.1,
            All(Issues[Status])
    )

     

    I tested yours and it also worked for me so thank you.

2 Replies

  • Hi PowerBI-Newbie -Can you try below measure with slight adjustments

     

    MaxChart All Faults Count - All with Status =
    CALCULATE(
    MAXX(
    ADDCOLUMNS(
    SUMMARIZE(ALL(Issues), Issues[Year:Period], Issues[Status]),
    "AllCount", [All Faults Count - All]
    ),
    [AllCount]
    ) * 1.1,
    REMOVEFILTERS(Issues[Status])
    )

     

    this measure should adjust dynamically based on the maximum fault count for each combination

    Hope it works

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

     

     

    • PowerBI-Newbie's avatar
      PowerBI-Newbie
      Icon for Helper IV rankHelper IV

      Hi rajendraongole1 ,

      I ended up having a play before you responded and found that I can do the following which also worked:

      MaxChart All Faults Count - All = 
      CALCULATE(
          MAXX(
              ADDCOLUMNS(DISTINCT(ALL(Issues[Year:Period],Issues[Status])),"AllCount",[All Faults Count - All]),[AllCount])*1.1,
              All(Issues[Status])
      )

       

      I tested yours and it also worked for me so thank you.