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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
VikKos
Regular Visitor

How to make calculation for each column individually by using Measures

Hello!

I have the list of SalesReps that have taken advance payments for their job and those that didn’t

After some time, they have a commission earned, which need to be paid.

I need to deduct parts of the advanced payment according to specific rules for those SalesReps that took advance payment. I need to calculate each person individually and show total amount to be paid in the PowerBI report

Report model is quite complex and I cannot do these calculations in calculated columns as long as it leads to the error of circular reference. However when I try to do it with the measures total amount is incorrect, as long as the formula deducts advance payment for all amount of all SalesRep (even for those that didn’t take advance payments)

Does anyone know how to make a measure that would calculate each person individually and sum up the results later.

I’ll be very grateful for your advise how to make this measure in correct way.

 

Current formula:

_To be paid in December INCORRECT = VAR PlannedPayment = SUMX('Commission',Commission[_Total commission])*0.2

VAR Half_of_PlannedPayment = SUMX(Commission,Commission[_Total commission])*0.1

VAR AdvPayment = SUMX('Advance Payments','Advance Payments'[Advance payment])

RETURN

IF(AdvPayment>Half_of_PlannedPayment,Half_of_PlannedPayment,PlannedPayment-AdvPayment)

 

Data:

 

SalesRepAdvance payment
Bob25000
Andy10000
Peter15000
John4000
James9000
Mary0
Tim0
Alex0

 

SalesRepCustomer NameOrder number_Total commission
BobCustomer1380206432514 162
AndyCustomer238020651134 145
PeterCustomer3380206505521 530
JohnCustomer438020650546 703
JamesCustomer5380206489724 156
JamesCustomer638020630887 285
JamesCustomer738020633291 530
MaryCustomer8380206371515 779
MaryCustomer938020645239 857
TimCustomer10380206377612 568
TimCustomer1138020637172 515
AlexCustomer1238020633502 986
AlexCustomer1338020639183 511

 

Relationship via SalesRep 1 to Many

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@VikKos  okay let's try this 

 

Measure =
SUMX (
    'Advance Payments',
    VAR AdvPayment = 'Advance Payments'[Advance payment]
    VAR PlannedPayment =
        SUMX ( RELATEDTABLE ( 'Commission' ), Commission[_Total commission] ) * 0.2
    VAR Half_of_PlannedPayment =
        SUMX ( RELATEDTABLE ( 'Commission' ), Commission[_Total commission] ) * 0.1
    RETURN
        IF (
            AdvPayment > Half_of_PlannedPayment,
            Half_of_PlannedPayment,
            PlannedPayment - AdvPayment
        )
)

 

smpa01_0-1636128139097.png

pbix is attached

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

4 REPLIES 4
smpa01
Super User
Super User

@VikKos  okay let's try this 

 

Measure =
SUMX (
    'Advance Payments',
    VAR AdvPayment = 'Advance Payments'[Advance payment]
    VAR PlannedPayment =
        SUMX ( RELATEDTABLE ( 'Commission' ), Commission[_Total commission] ) * 0.2
    VAR Half_of_PlannedPayment =
        SUMX ( RELATEDTABLE ( 'Commission' ), Commission[_Total commission] ) * 0.1
    RETURN
        IF (
            AdvPayment > Half_of_PlannedPayment,
            Half_of_PlannedPayment,
            PlannedPayment - AdvPayment
        )
)

 

smpa01_0-1636128139097.png

pbix is attached

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@smpa01  Now it works correctly. Thanks a lot for your help!

smpa01
Super User
Super User

@VikKos  the measure is producing this. What are you expecting and why?

 

smpa01_0-1636125544098.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hi @smpa01 

Total amount is supposed to be 17 394, instead of 12 673. As long as advanced payment for 3 SalesReps should not be deducted. Current table shows correct values for the rows, but incorrect total. Only in case calculated column is used I can get this correct Total amount.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.