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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Adams_Apple
New Member

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.