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

How to correct measure total

I’m stuck with this, the total is not showing the correct total. I am use the below measure and is working but for the total. Could anyone please help?

 

Total Bonus =

VAR AllBonus = SUM('table 1'[Sale Bonus Amount])

VAR ApprovedCust = SELECTEDVALUE('table 1' [ApprovedCustId])

VAR BonusEx = CALCULATE(SUM('table 1' [Sale Bonus Amount]) *2, 'table 1' [Sale Bonus Amount] = AllBonus, 'table 1' [ApprovedCustId] = ApprovedCust)

RETURN

IF(ISBLANK(ApprovedCust), AllBonus, BonusEx)

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Dtrain , You need to use group by of visual and create thsi formula assume, you are using ApprovedCustId in visual or use somthing else which is on row or non summarized

 

Total Bonus =
VAR AllBonus = SUM('table 1'[Sale Bonus Amount])
VAR ApprovedCust = SELECTEDVALUE('table 1' [ApprovedCustId])
VAR BonusEx = CALCULATE(SUM('table 1' [Sale Bonus Amount]) *2, 'table 1' [Sale Bonus Amount] = AllBonus, 'table 1' [ApprovedCustId] = ApprovedCust)
RETURN
sumx(values( Table[ApprovedCustId]), IF(ISBLANK(ApprovedCust), AllBonus, BonusEx))

 

for more than one column use summarize

 

Total Bonus =
VAR AllBonus = SUM('table 1'[Sale Bonus Amount])
VAR ApprovedCust = SELECTEDVALUE('table 1' [ApprovedCustId])
VAR BonusEx = CALCULATE(SUM('table 1' [Sale Bonus Amount]) *2, 'table 1' [Sale Bonus Amount] = AllBonus, 'table 1' [ApprovedCustId] = ApprovedCust)
RETURN
sumx(Summarize( Table[ApprovedCustId],"_1", IF(ISBLANK(ApprovedCust), AllBonus, BonusEx)),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Dtrain , You need to use group by of visual and create thsi formula assume, you are using ApprovedCustId in visual or use somthing else which is on row or non summarized

 

Total Bonus =
VAR AllBonus = SUM('table 1'[Sale Bonus Amount])
VAR ApprovedCust = SELECTEDVALUE('table 1' [ApprovedCustId])
VAR BonusEx = CALCULATE(SUM('table 1' [Sale Bonus Amount]) *2, 'table 1' [Sale Bonus Amount] = AllBonus, 'table 1' [ApprovedCustId] = ApprovedCust)
RETURN
sumx(values( Table[ApprovedCustId]), IF(ISBLANK(ApprovedCust), AllBonus, BonusEx))

 

for more than one column use summarize

 

Total Bonus =
VAR AllBonus = SUM('table 1'[Sale Bonus Amount])
VAR ApprovedCust = SELECTEDVALUE('table 1' [ApprovedCustId])
VAR BonusEx = CALCULATE(SUM('table 1' [Sale Bonus Amount]) *2, 'table 1' [Sale Bonus Amount] = AllBonus, 'table 1' [ApprovedCustId] = ApprovedCust)
RETURN
sumx(Summarize( Table[ApprovedCustId],"_1", IF(ISBLANK(ApprovedCust), AllBonus, BonusEx)),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

have a doubt related to this if we are crating a new measure to insure that total come correct should we use the correct total measure in bar and line chart visual also or we can use the same measure which is being used in table visual  and giving the total value wrong but indivisual row value correct 

Thank you for your support

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 Kudoed Authors