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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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