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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Get Minimum of Group within Column but handle duplicate values

So I have a price column by day. This column can contain duplicates. I'm trying to create a column that returns "Y" when the value in the Price column is the Minimum amount. However, I only want to return one "Y" even though there can be two or more minimum prices. Is there a way to handle this? This is what I have:

 

Min Indicator =
IF (
    CALCULATE (
        MIN ( 'Historical'[Price] ),
        FILTER (
            'Historical',
            'Historical'[Rank Key] = EARLIER ( 'Historical'[Rank Key] )
        )
    ) = [Price],
    "Y",
    "N"
)

 

But if the minimum price shows up twice, it returns two "Y" values which I don't want.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try the following formula to create a column after adding a Index column:

 

3.25.4.Index.PNG

Min Indicator =
VAR _min =
    CALCULATE (
        MIN ( 'Historical'[Price] ),
        ALLEXCEPT ( Historical, Historical[Rank Key] )
    )
VAR _first =
    MINX (
        FILTER (
            'Historical',
            'Historical'[Rank Key] = EARLIER ( 'Historical'[Rank Key] )
                && 'Historical'[Price] = _min
        ),
        [Index]
    ) 
//Or use FIRSTNONBLANK()
// var _f =
// CALCULATE (
//     FIRSTNONBLANK ( 'Historical'[Index], TRUE () ),
//     FILTER (
//         'Historical',
//         'Historical'[Rank Key] = EARLIER ( Historical[Rank Key] )
//             && 'Historical'[Price] = _min
//     )
// )

RETURN
    IF ( _first = [Index], "Y", "N" )

The final output is shown below:

3.25.4.The first Minimum.PNG

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try the following formula to create a column after adding a Index column:

 

3.25.4.Index.PNG

Min Indicator =
VAR _min =
    CALCULATE (
        MIN ( 'Historical'[Price] ),
        ALLEXCEPT ( Historical, Historical[Rank Key] )
    )
VAR _first =
    MINX (
        FILTER (
            'Historical',
            'Historical'[Rank Key] = EARLIER ( 'Historical'[Rank Key] )
                && 'Historical'[Price] = _min
        ),
        [Index]
    ) 
//Or use FIRSTNONBLANK()
// var _f =
// CALCULATE (
//     FIRSTNONBLANK ( 'Historical'[Index], TRUE () ),
//     FILTER (
//         'Historical',
//         'Historical'[Rank Key] = EARLIER ( Historical[Rank Key] )
//             && 'Historical'[Price] = _min
//     )
// )

RETURN
    IF ( _first = [Index], "Y", "N" )

The final output is shown below:

3.25.4.The first Minimum.PNG

 

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

sayaliredij
Solution Sage
Solution Sage

You can try using RANKX instead of finding out the Minimum and assign Y when the rank is 1 

This way you can probably solve the issue. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors