Forum Discussion

rjg2g11's avatar
rjg2g11
Advocate I
8 years ago
Solved

Minimum Value across multiple columns

 

Hello,

 

I am trying to create a column that picks out the minimum value from a number of columns. 

 

I have posted a table below with my desired outcome

 

Can someone advise?

 

Many Thanks

 

 

IDABCDEFGDesired Column
3618509819.983914.70000C
368551672229.51801817.818.5F
3493843025.9827.9817.80020.517G
3800155423.627.316.2816.200D
32315810027.116.70016.516.1G
3212523922.12716.40016.117.8F
  • rjg2g11

     

     

    After unpivoting your Letter Columns, you can use following MEASURE to get the desired Output

     

    DesiredResult =
    VAR MinValue =
        CALCULATE ( MIN ( TableName[Value] ), TableName[Value] <> 0 )
    RETURN
        CONCATENATEX (
            FILTER ( TableName, TableName[Value] = MinValue ),
            TableName[Attribute],
            ", "
        )

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Easiest thing to do would be to unpivot your letter columns. At that point, the problem is trivial.

    • wilson_smyth's avatar
      wilson_smyth
      Post Patron

      make sure to specify that you dont care about zeros, as in your dataset, the lowest value is zero, even though its your outcome in the sample data specifies you want the lowest value that is greater than zero.

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Community Champion

        rjg2g11

         

         

        After unpivoting your Letter Columns, you can use following MEASURE to get the desired Output

         

        DesiredResult =
        VAR MinValue =
            CALCULATE ( MIN ( TableName[Value] ), TableName[Value] <> 0 )
        RETURN
            CONCATENATEX (
                FILTER ( TableName, TableName[Value] = MinValue ),
                TableName[Attribute],
                ", "
            )