Forum Discussion

MatheusFraga's avatar
MatheusFraga
New Member
2 years ago
Solved

How to count the smallest values

Good day, I need a measure that counts the number of lowest prices from each supplier, as in the table on the right:    Thanks
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi MatheusFraga ,

     

    Please try code as below to create a measure.

    Qt.Of best price =
    VAR _SUMMARIZE =
        SUMMARIZE (
            FILTER (
                ADDCOLUMNS (
                    'Table',
                    "Lowest Price", CALCULATE ( MIN ( 'Table'[Price] ), ALLEXCEPT ( 'Table', 'Table'[Product] ) )
                ),
                [Price] = [Lowest Price]
            ),
            [Supplier],
            [Product],
            [Price]
        )
    RETURN
        COUNTAX ( _SUMMARIZE, [Product] ) + 0

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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