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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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!:
The Definitive Guide to Power Query (M)

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!:
The Definitive Guide to Power Query (M)

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors