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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
quintans1
Frequent Visitor

Calculated Column to provide a minimum numerical value based on multiple criteria

I need assistance in creating a calculated column that will show the minimum value (Location Number) based on multiple criteria (Category Number, Country, Location Number). I am hoping I can also see the minimum numerical value when a row has no value.

 

So for each Category/Country combo, the calculated column returns back the minimum Location Number, I need it to provide the minimum location number in the event the Location Number is blank.

 

calculatedcolumn.PNG

1 ACCEPTED SOLUTION

Thank you very much, the dax for the column works in your PBIX, but when I try to employ what you wrote to my work pbix, the calculated column partially works. Confusing since I see that it works in what you provided.

 

I ended up using DAX like this below in my work pbix and I get the same result in your dax and works completely in my work pbix.

test_column = CALCULATE (
    MIN (Data[Location Number]),
    ALLEXCEPT (Data,Data[Category Number],Data[Country])
)

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, I am not sure if I understood you question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1688009355846.png

 

 

Expected result CC =
CALCULATE (
    MIN ( Data[Location Number] ),
    INDEX (
        1,
        FILTER (
            SUMMARIZE ( Data, Data[Category Number], Data[Country], Data[Location Number] ),
            Data[Location Number] <> BLANK ()
        ),
        ORDERBY ( Data[Location Number], ASC ),
        DEFAULT,
        PARTITIONBY ( Data[Category Number], Data[Country] )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you very much, the dax for the column works in your PBIX, but when I try to employ what you wrote to my work pbix, the calculated column partially works. Confusing since I see that it works in what you provided.

 

I ended up using DAX like this below in my work pbix and I get the same result in your dax and works completely in my work pbix.

test_column = CALCULATE (
    MIN (Data[Location Number]),
    ALLEXCEPT (Data,Data[Category Number],Data[Country])
)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors