Forum Discussion

Jo5hua22's avatar
Jo5hua22
Helper I
4 years ago
Solved

Max value based on filter

Hi Users

 

Can you please help me with finding the maximum value based on filters?

 

Steps to be done:

1. Filter Measurement Type as Trial 1.

2. Filter Machine as 1011

3. In the quantity, you can see 3 rows as 5,8,1. This means that there are 8 measurements to be done but on 2 rows, only 5 & 1 measurement were done. 

4. So, I need to determine the maxiumum value based on the mentioned filter. Can you please help me with this?

 

 

Please find the sample picture of the dataset below.

amitchandakValtteriN  : Can you please help me out?

  • Jo5hua22's avatar
    Jo5hua22
    4 years ago

    Hi all

    Thanks for your comments. I managed to find a solution for my problem

    In a measure variable,

    #Meas =
    CALCULATE(
    MAXX(
    SUMMARIZE(Table1,Table1[Measurement Type],Table1[Machine],"Count",COUNT(Table1[Qty]))
    ,[Count]
    ),ALLEXCEPT(Table1,Table1[Measurement Type],Table1[Machine]))

7 Replies

  • Hi Jo5hua22, are we missing a piece of the puzzle as it looks like you could just use MAX aggregation on the Qty column?:

    MAX(Qty)

     

    • tamerj1's avatar
      tamerj1
      Community Champion

      Russell-PBI Actually many pieces were missing but Jo5hua22 clearified all to me before he eventually found the solution by himself. I think there is another post by him of the same. 

    • Jo5hua22's avatar
      Jo5hua22
      Helper I

      Hi all

      Thanks for your comments. I managed to find a solution for my problem

      In a measure variable,

      #Meas =
      CALCULATE(
      MAXX(
      SUMMARIZE(Table1,Table1[Measurement Type],Table1[Machine],"Count",COUNT(Table1[Qty]))
      ,[Count]
      ),ALLEXCEPT(Table1,Table1[Measurement Type],Table1[Machine]))

  • Hi Russell-PBI 

    I need to apply filters as mentioned in the steps. Max(QTY) just shows the maximum value in the table

    • Russell-PBI's avatar
      Russell-PBI
      Resolver II

      Do you mean you want a measure that itself is filtered, like this?:

      Max Qty - 1011 and Trial 1 = 
      CALCULATE(
      MAX('Table'[Qty])
      , 'Table'[Machine] = 1011
      , 'Table'[Measurement Type] = "Trial 1"
      )
  • v-robertq-msft's avatar
    v-robertq-msft
    Community Support

    Hi, 

    According to your description, I can roughly understand your requirement, I think you can achieve this using the slicers in the Power BI and the visual TOPN filter:

     

    You can create two slicers to place the field [Measurement Type] and [Machine] and a table chart to place the columns within the table, then you can set the visual filter as “TOPN” for the table chart like this:

     

    And you can get what you want.

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.