Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MatheusFraga
New Member

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:

 

b893183b-a008-42cf-9be3-6dea994fcfd3.png

 Thanks

1 ACCEPTED SOLUTION

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.

vrzhoumsft_0-1698040839138.png

 

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.

View solution in original post

3 REPLIES 3
Dangar332
Super User
Super User

Hi, @MatheusFraga 

Is there any creiteria that define number less then x is lower numbe 

Yes, the column Product. I need the lowest price for each Product, then rank the Suppliers

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.

vrzhoumsft_0-1698040839138.png

 

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.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.