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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Adams_Apple
Frequent Visitor

Trouble with Column Totals on IF Measure

Thanks for helping, I've dug through all the posts and tried what seems to help but I can't get my totals to work when I am using values from an IF measure.

Adams_Apple_1-1731428521737.png

I have a table of actual data, that the measure uses if there has been product packed in that month. If nothing has been packed, it uses Projection data from a different table.

Here is the measure:

 

ProductPacked = SUMX(
    VALUES('Crop Year'[Crop Year]),
    IF(SUM('Company Product'[Product Packed]) > 0,
        SUM('Company Product'[Product Packed]),
        MAX(Projections[Product Packed])))

 

No matter what I do, the totals only include the actual data and not the projections.

Any help is much appreciated!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

ProductPacked =
SUMX (
    VALUES ( 'Date'[Year Month] ),
    IF (
        SUM ( 'Company Product'[Product Packed] ) > 0,
        SUM ( 'Company Product'[Product Packed] ),
        MAX ( Projections[Product Packed] )
    )
)

instead of doing the SUMX over the year column you need to do it over the year month column.

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

Try

ProductPacked =
SUMX (
    VALUES ( 'Date'[Year Month] ),
    IF (
        SUM ( 'Company Product'[Product Packed] ) > 0,
        SUM ( 'Company Product'[Product Packed] ),
        MAX ( Projections[Product Packed] )
    )
)

instead of doing the SUMX over the year column you need to do it over the year month column.

Thank you! that works,

is there a way I can add FILTER into that to include the CROP YEAR filter? Crop year is a text field, not a date. and it doesn't align with a traditional Jan-Dec year, so it makes my life extra interesting.

Instead of 'Date'[Year Month] you can use whichever field you are using on the columns of your matrix.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.