Forum Discussion

StevenT's avatar
StevenT
Helper V
1 year ago

minimum value working, max not working

Hi, I'm using a min and max to use in my KPI. The minimum works fine, but for some reason the maximum isn't giving me the maximum value.

The highest value in the table is  1231 and it's incorrect in KPI progress
The lowest value is 76 and it's correct in the KPI Progress visual

Sorted by highest

Sorted by Lowest

 

 

Min Measure

VAR SummaryTable =
    SUMMARIZE(
        ALL('TrackSales'),  -- Use ALL to remove filters on the entire table
        'TrackSales'[fkTrackList],
        "TotalSales", SUM('TrackSales'[SalesAmt])
    )
RETURN
    MINX(SummaryTable, [TotalSales])

Max Measure (this one is returning incorrect values).
    VAR SummaryTable =
    SUMMARIZE(
        ALL('TrackSales'),  -- Use ALL to remove filters on the entire table
        'TrackSales'[fkTrackList],
        "TotalSales", SUM('TrackSales'[SalesAmt])
    )
RETURN
MAXX(SummaryTable, [TotalSales])
___________________________________________________________________________
So what do you think I'm doing wrong?  Kind of stumped.
Thanks, Steven Taub

3 Replies

  • StevenT 

     

    Isn't the top chart a gauge?  If so just drag the Sales field into the Min and max wells and choose Min and Max as the aggregation?

     

     

    If you have to write measures you can use

     

    Min Sales = MIN(ALL('DataTable'[Sales]))
    Min Sales = MAX(ALL('DataTable'[Sales]))

     

     

    Regards

     

    Phil

     

     

    • StevenT's avatar
      StevenT
      Helper V

      That won't work in this case.  I have to basically calculate multiple sales and aggregate them together to discover the largest and smallest $.

      • PhilipTreacy's avatar
        PhilipTreacy
        Super User

        StevenT 

         

        Please supply some sample data so that we know what you are working with and understand how you are getting the MAX and MIN values shown in your visual.

         

        Phil