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
michael_knight
Post Prodigy
Post Prodigy

Total of an IF statement

Hi,

 

I'm trying to use an IF statement within a Table visual and I'm having issues with the total column.

 

Margin Measure = CALCULATE(SUMX(FILTER(Sheet1, Sheet1[Agent] = "John"), Sheet1[Margin]), USERELATIONSHIP('Date'[Full Date], Sheet1[Date]))
Total = IF([Margin Measure] >=100, 1000, BLANK()) 

Those are the measure that I use in this table:

 

iftable.PNG

As you can see, the total isn't correct. It this case the total should be 2000

 

Does anyone know how to fix this?

 

https://www.dropbox.com/s/yl5ypb8tz8asim7/help%20-%20Copy.pbix?dl=0

 

Thanks

1 ACCEPTED SOLUTION

@michael_knight 

Do a crossjoin:

Total = 
SUMX(
    CROSSJOIN( VALUES(Agents[Agent]),VALUES('Date'[Month/Year])) ,
    IF([Margin Measure] >=100, 1000, BLANK()) 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@michael_knight 

You can make your relationship active between Date and Sheet tables and modify the measure as below:

Total = 
SUMX(
    SUMMARIZE(Sheet1,Agents[Agent],'Date'[Month/Year]),
    IF([Margin Measure] >=100, 1000, BLANK()) 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy thanks for the response, I need to have the relationship inactive. I tried to recreate my main dataset as best as possible, as I'm using multiple date columns with the Date table I needed to have them inactive

 

Do you know how I'd be able to do the measure you suggested but with the relationship inactive?

@michael_knight 

Do a crossjoin:

Total = 
SUMX(
    CROSSJOIN( VALUES(Agents[Agent]),VALUES('Date'[Month/Year])) ,
    IF([Margin Measure] >=100, 1000, BLANK()) 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Good stuff, thank you!

 

Out of curiosity, will this measure work with Switch(True() ?

Greg_Deckler
Community Champion
Community Champion

@michael_knight This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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