Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

MAXX SUM value return category (Hour range)

I have a table with hour ranges and summed values:

 

Hour RangesValues
09.00 - 10.0010
10.00 - 11.00117
11.00 - 12.00215
12.00 - 1.002040
1.00 - 2.001711
2.00 - 3.002323
3.00 - 4.004511
4.00 - 5.001109

 

I have used this measure to grab the MAXX value e.g. 4511

Hours Range - MAX  = 

MAXX(
    CALCULATETABLE(
        VALUES('Table'[Hours Range])
        )
    , CALCULATE(
        SUM('Table'[Value])
        )
    )
    
but is there a way to reverse this i.e. give me the hour range where the MAXX summed value occured? (3.00-4.00pm)
 
  • Hi Anonymous ,

     

    According to your description, I did the following test for your reference:

    M = 
    VAR a =
        MAX ( 'Table (2)'[Values] )
    RETURN
        CALCULATE (
            MAX ( 'Table (2)'[Hour Ranges] ),
            FILTER ( ALL ( 'Table (2)' ), 'Table (2)'[Values] >= a )
        )

     


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

    Best Regards,
    Henry


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

2 Replies

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion
    Measure = MAXX( TOPN( 1, 'Table', 'Table'[Values] ), 'Table'[Hour Ranges] )
  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    According to your description, I did the following test for your reference:

    M = 
    VAR a =
        MAX ( 'Table (2)'[Values] )
    RETURN
        CALCULATE (
            MAX ( 'Table (2)'[Hour Ranges] ),
            FILTER ( ALL ( 'Table (2)' ), 'Table (2)'[Values] >= a )
        )

     


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

    Best Regards,
    Henry


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