Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX: retrieve the minimum value among the values above another

Hello,   I need help from the community   I need to find a solution in DAX   Let me explain: I have several columns: Item, QuantityA and QuantityB. (QuantityB is from a merge with another tabl...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a new table.

     

     

     

    New Table = 
    ADDCOLUMNS (
        SUMMARIZE ( Data, Data[Articles], Data[QuantityA] ),
        "@QuantityB",
            SUMX (
                FILTER (
                    GROUPBY (
                        FILTER (
                            ADDCOLUMNS ( Data, "@flag", IF ( Data[QuantityA] < Data[QuantityB], 1 ) ),
                            [@flag] = 1
                        ),
                        Data[Articles],
                        "@MinB", MINX ( CURRENTGROUP (), Data[QuantityB] )
                    ),
                    Data[Articles] = EARLIER ( Data[Articles] )
                ),
                [@MinB]
            ) + 0
    )