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
rafsta
Frequent Visitor

Measure that sums based on 3 columns

Hi everyone,

 

I'm trying to create a measure that sums my orders quantity based on the item (string) , orderID (string)  and a date (datetime) at the same time. This columns are in the same table.

 

In Excel I've used a sumifs that contains all my parameters (with &) and it worked, but now I'm trying to do the same in PBI and I simply can't. Because it gets all values based only in one of these parameters (the item).

 

I already tried:

 

Measure=

Var PO= MAX('PO''s'[PO])
Var itens= MAX('PO''s'[Item])
Var data= MAX('PO''s'[Data])
VAR Planejado = CALCULATE(SUM('PO''s'[Planejado]),
FILTER(
ALL('PO''s'),
'PO''s'[Data] = data
&& 'PO''s'[PO] = PO
&& 'PO''s'[Item] = itens
))
RETURN Planejado
 
But still showing wrong results.
 
Example:
Its showing 1824000 for both lines in "Planejado", but should look like these 
ItemPODataPlanejado
20146612100005721/04/20211392000,00
20146612100007814/04/2021432000,00
 
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @rafsta

Please  try formula as below:

Measure2 =
CALCULATE (
    SUM ( 'Table'[Planejado] ),
    ALLEXCEPT ( 'Table', 'Table'[Item], 'Table'[PO], 'Table'[Data] )
)
Measure3 = 
VAR PO =
    MAX ( 'Table'[PO] )
VAR itens =
    MAX ( 'Table'[Item] )
VAR data =
    MAX ( 'Table'[Data] )
VAR Planejado =
        SUMX( 
        FILTER (
            ALL ( 'Table' ),
            'Table'[Data] = data
                && 'Table'[PO] = PO
                && 'Table'[Item] = itens
        ),
        'Table'[Planejado]
    )
return 
Planejado

 

 

 

If it doesn't meet your requirement, please share you sample pbix file/data  and details for testing.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

4 REPLIES 4
v-easonf-msft
Community Support
Community Support

Hi, @rafsta

Please  try formula as below:

Measure2 =
CALCULATE (
    SUM ( 'Table'[Planejado] ),
    ALLEXCEPT ( 'Table', 'Table'[Item], 'Table'[PO], 'Table'[Data] )
)
Measure3 = 
VAR PO =
    MAX ( 'Table'[PO] )
VAR itens =
    MAX ( 'Table'[Item] )
VAR data =
    MAX ( 'Table'[Data] )
VAR Planejado =
        SUMX( 
        FILTER (
            ALL ( 'Table' ),
            'Table'[Data] = data
                && 'Table'[PO] = PO
                && 'Table'[Item] = itens
        ),
        'Table'[Planejado]
    )
return 
Planejado

 

 

 

If it doesn't meet your requirement, please share you sample pbix file/data  and details for testing.

 

Best Regards,
Community Support Team _ Eason

Anonymous
Not applicable

You should be using SUMX rather than SUM for these. 

HashamNiaz
Solution Sage
Solution Sage

Hi !

Please share the sample data.

 

Regards, 

Ok!

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