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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

IF Condition wrong Total

I m trying to do a total of income but the total number is coming wrong can anyone help me.

 

Income Increases = 
//=IF(LEFT(A8,1)="4",IF(B8<C8,(C8-B8),0),0)
Var _Base = CALCULATE([Base Switch],FILTER(Real_Data,Real_Data[GLSubAccountTypeName]="Income"))
Var _Comp = CALCULATE([Comp Switch],FILTER(Real_Data,Real_Data[GLSubAccountTypeName]="Income"))
Var _logicTest = IF(_Base>_Comp,1,0)
Var _logic = IF(_Base>_Comp,(_Base-_Comp),0)
Return
_logic

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

HI @Anonymous 

 

Please check this post:

https://www.vahiddm.com/post/why-my-measure-returns-the-wrong-total

 

VahidDM_0-1645661125837.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

HI @Anonymous 

 

Please check this post:

https://www.vahiddm.com/post/why-my-measure-returns-the-wrong-total

 

VahidDM_0-1645661125837.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Anonymous
Not applicable

@Greg_Deckler can please check it

@Anonymous This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.