Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
3 years ago

Min function for measure in Power BI

Hi,

 

How write minimum function min for measure? min(dm) error.

12 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Analitika This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

    The pattern is:
    MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
    MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
    AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
    etc.

    • Analitika's avatar
      Analitika
      Icon for Post Prodigy rankPost Prodigy

      I have a column date.

      measure=selectvalue(date)

      min(measure) getting error.

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        Analitika There is no reason to get a MIN of a measure in your case. Measures return a single value. Thus, min, max, sum, average, it's all the same. Just reference the measure directly:

         

        [measure]

         

        Nothing around it.

        If you need to get a min of a measure in a table context, then see previous message. But, you have to return a table with the measure calculated at each row and then use MINX across that table to get the minimum of the measure within that table context.