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
LuukP
Helper I
Helper I

Table Incorrect Total - Need help with HASONEFILTER

Hi all,

 

Sorry for yet another 'Incorrect Total' message, but I haven't been able to figure this one out...

 

Here is my table visual with the incorrect total in the "Realized New Business" column:

LuukP_0-1698344576067.png

The Realized New Business CP column sums dollar amounts in a measure for the Current Period.

The Realized New Business PP column sums dollar amounts in a measure for the Previous Period.

The logic for the Realized New Business column is 'if CP - PP < 0 then 0 otherwise CP - PP'.  Here is the actual formula:

 
Realized New Business =
var _CP = [Realized New Business CP]
var _PP = [Realized New Business PP]

return IF(
        HASONEFILTER('SLX ACCOUNT'[ACCOUNT]),
            if(_CP - _PP < 0, 0, _CP - _PP
            ),
           // THIS IS WHERE I NEED HELP
        )
Can anyone help with the part of the formula that I've bolded?
 
Thanks in advance,
 
Luuk
2 ACCEPTED SOLUTIONS

@LuukP Try using ALLSELECTED instead of ALL

 

Also...First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

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

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



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...

View solution in original post

Hi Greg - thanks for the feedback - that got me close, but there was nothing on the Total line...  I did look at your reference articles earlier and revisited them and did get it to work.

 

My solution was this:

The measure I was struggling with I kept simple:

Realized New Business =
var _CP = [Realized New Business CP]
var _PP = [Realized New Business PP]
var _rnb = _CP-_PP
RETURN IF(_rnb < 0, 0, _rnb)

 

Then, I added a new measure:

Total RNB = 

IF(HASONEFILTER('tablename'[ID]), [Realized New Business], SUMX(VALUES('tablename'[ID]),[Realized New Business])

I thought I could do it without adding another measure, but at least this did the trick - based on the articles you provided.  Thank you!!

View solution in original post

4 REPLIES 4
Dangar332
Super User
Super User

hi, @LuukP 

try below

Realized New Business =
sumx(
    filter(
       all('yourtablename'[client no]),
       _CP - _PP > 0
           )
    _CP - _PP 
     )

Thanks Dangar - unfortunately that didn't work.  The _CP and _PP variables are based on measures with filters, so I would need to preserve those filters.

@LuukP Try using ALLSELECTED instead of ALL

 

Also...First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

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

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



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...

Hi Greg - thanks for the feedback - that got me close, but there was nothing on the Total line...  I did look at your reference articles earlier and revisited them and did get it to work.

 

My solution was this:

The measure I was struggling with I kept simple:

Realized New Business =
var _CP = [Realized New Business CP]
var _PP = [Realized New Business PP]
var _rnb = _CP-_PP
RETURN IF(_rnb < 0, 0, _rnb)

 

Then, I added a new measure:

Total RNB = 

IF(HASONEFILTER('tablename'[ID]), [Realized New Business], SUMX(VALUES('tablename'[ID]),[Realized New Business])

I thought I could do it without adding another measure, but at least this did the trick - based on the articles you provided.  Thank you!!

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.