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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ppaiva
Regular Visitor

How to Sum a min measure

Hi, 

I'm trying to create a Measure that gives SUM of MINs under 2 different geography levels, but I couldn't sort it out after many attempts.

 

This is my table and data example

 

Geo1Geo2CategoryComponentQty
AA1CAT1Comp11
AA1CAT1Comp22
AA1CAT2Comp13
AA1CAT2Comp24
AA2CAT1Comp15
AA2CAT1Comp26
AA2CAT2Comp17
AA2CAT2Comp28

 

This is the desired Measure output for 2 different configurations:


First Case:

Geo1CategoryResult Measure Desired
ACAT16
ACAT210

 

I expect this result because:

For Geo1 = A, Category = CAT1,

Sum(Comp1)=6, Sum(Comp2)=8

Min(6,8) = 6

 

Second case:

Geo1Geo2CategoryResult Measure Desired
AA1CAT11
AA1CAT23
AA2CAT15
AA1CAT27

 

I expect this result because:

For Geo1 = A, Geo2 = A1, Category = CAT1,

Sum(Comp1)=1, Sum(Comp2)=2

Min(1,2) = 1

 

For Geo1 = A, Geo2 = A2, Category = CAT1,

Sum(Comp1)=5, Sum(Comp2)=6

Min(5,6) = 5

 

Basically what I'm trying to do is to check at Geo1 Level and Category what's the minimum number of components available, and from there define the category result. 

 

If I add Geo2, I pretend to have this measure reconstructed to recalculate the equation at that level.

 

In a practical example, if for Geo1 = US, CAT1 = PC, I have COMP1 = SCREEN, COMP2 = KEYBOARD, the minimum number of available PCs in US is equal to the minimum of SCREENs and KEYBOARDs in US, independently if they are in different cities. But I want to check the quantities of PCs that I have in Geo2 = New York City, the number would be the minimum of components in that city only. Hope it makes sense Smiley Happy

 

I tried this option without any logic result:

Measure = 
SUMX ( 
VALUES ('Table'[Category]),
(
CALCULATE(
MINX(
SUMMARIZE('Table','Table'[Geo1],'Table'[Category],'Table'[Component],"XX",
SUM('Table'[Qty]))
,[XX])))
)

And this one:

Measure2 = MINX(
SUMMARIZE('Table','Table'[Geo1],'Table'[Category],'Table'[Component],"XX",
SUM('Table'[Qty]))
,[XX])

This last one works ok if I have Geo2 level, but if I remove it, the result is not recalculating at Geo1

 

I would appreciate some help.

Thanks and regards,
Pablo

1 REPLY 1
Anonymous
Not applicable

What about something like this:

Min Measure = 
CALCULATE(
    MINX(
        ADDCOLUMNS(
            SUMMARIZE( 
                Table1,
                Table1[Category],
                Table1[Geo1],
                Table1[Component]
            ),
            "Min", 
            CALCULATE(
                SUM( Table1[Qty])
            )
        ), 
        [Min]
    )
)

MINX of Summarize.png

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors