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
dknispel
Regular Visitor

Adding a spread of one row to all of the other rows

I'm stuck on this problem.  In a report I'm trying to spread the amount from one row across all of the other rows of the report.  The amount added is based on their percentage of the total (less that one row).  In the example below, the total from Daniel's account would get split up and added to the total for each account, and Daniel's account would go to zero.

 

So the report would look like this

ParentChildDesriptionTotal% of Total
(less Dan's)
Add toTotal to
Chargeback
1000010001Albert's Account5819.9434.32%       1,509.22      7,329.16
1000010002Daniel's Account4397.13-100.00%     (4,397.13)                  -  
1000010003David's Account6412.2737.82%       1,662.82      8,075.09
1000010004Donald's Account4724.2427.86%       1,225.09      5,949.33
Total  21353.580.00%                   -  21353.58

 

I've made an attempt.  It is in https://drive.google.com/open?id=0B3kwDNYgqUTYNWFua1N0dEVINUU

 

The problem with my attempt is that is relies on the totals at the end of the report and doesn't work when you filter by invoice.  

 

Anyone have any ideas how I should fix this?

 

The definitions for the columns in the report.

 

Column 1 "Parent" comes from the "Parent" column in the Detail Table

Column 2 "Child" comes from the "Child" column in the Detail Table

Column 3 "Description" comes from the "Description" column in the Master data

Column 4 "Total" comes from the "TotalCost" column in the Detail Table

Column 5 "% of Total Less Dan's" is equal to the rows subtotal of "Total" divided by the calculation of the grand "Total" minus the subtotal of "Total" from the row for child account account 10002.  This is the column I don't know how to calculate.

Column 6 "Add to" is equal to Column 5 times the subtotal of Total for child account 10002.

Column 7 "Total to Chargeback" is equal to Column 4 added to Column 6

 

Detail table

InvoiceParentChildRecordTypeCostBeforeTaxCreditsTaxAmountTaxTypeTotalCost
123451000010001LinkedLineItem926.1200None926.12
123451000010001LinkedLineItem1547.5200None1547.52
123451000010001LinkedLineItem386.8800None386.88
123501000010001LinkedLineItem19.4400None19.44
123501000010001LinkedLineItem13.5151900None13.51519
123501000010001LinkedLineItem926.1200None926.12
123511000010001LinkedLineItem65.9448100None65.94481
123511000010001LinkedLineItem1547.5200None1547.52
123511000010001LinkedLineItem386.8800None386.88
123451000010002LinkedLineItem771.5300None771.53
123451000010002LinkedLineItem000None0
123451000010002LinkedLineItem1309.7200None1309.72
123501000010002LinkedLineItem463.0600None463.06
123501000010002LinkedLineItem12.3300None12.33
123501000010002LinkedLineItem771.52800None771.528
123511000010002LinkedLineItem846.6600None846.66
123511000010002LinkedLineItem19.4400None19.44
123511000010002LinkedLineItem202.8600None202.86
123451000010003LinkedLineItem723.3600None723.36
123451000010003LinkedLineItem173.8800None173.88
123451000010003LinkedLineItem202.8600None202.86
123501000010003LinkedLineItem631.5700None631.57
123501000010003LinkedLineItem926.1200None926.12
123501000010003LinkedLineItem1547.5200None1547.52
123511000010003LinkedLineItem173.8800None173.88
123511000010003LinkedLineItem1309.7200None1309.72
123511000010003LinkedLineItem723.3600None723.36
123451000010004LinkedLineItem723.3600None723.36
123451000010004LinkedLineItem173.8800None173.88
123451000010004LinkedLineItem202.8600None202.86
123501000010004LinkedLineItem386.8800None386.88
123501000010004LinkedLineItem926.1200None926.12
123501000010004LinkedLineItem1547.5200None1547.52
123511000010004LinkedLineItem173.8800None173.88
123511000010004LinkedLineItem202.8600None202.86
123511000010004LinkedLineItem386.8800None386.88
 1000010001AcctTotal5819.9400None5819.94
 1000010002AcctTotal4397.12800None4397.128
 1000010003AcctTotal6412.2700None6412.27
 1000010004AcctTotal4724.2400None4724.24
 10000 StmtTotal21353.5800None21353.58

 

Master table

Account #DescriptionCharge Back to
10000Master AccountCompany
10001Albert's AccountAl's Credit Card
10002Daniel's AccountInvoice
10003David's AccountInvoice
10004Donald's AccountInvoice
2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@dknispel wrote:

In a report I'm trying to add the amount from one row across all of the other rows of the report.  The amount I add is based on their percentage of the total (less that one row).  In the example below, the total from Daniel's account would get split up and added to the total for each account, and Daniel's account would go to zero.

 

So the report would look like this

Parent Child Desription Total % of Total
(less Dan's)
Add to Total to
Chargeback
10000 10001 Albert's Account 5819.94 34.32%        1,509.22       7,329.16
10000 10002 Daniel's Account 4397.13 -100.00%      (4,397.13)                   -  
10000 10003 David's Account 6412.27 37.82%        1,662.82       8,075.09
10000 10004 Donald's Account 4724.24 27.86%        1,225.09       5,949.33
Total     21353.58 0.00%                    -   21353.58

 

 

@dknispel

What is the add to column and Total to Chargeback? Meanwhile I don't find any account description in  the sample data. Please be more specific on the logic from the sample data to the expected output.

Thanks.  I updated the orginal post with the information you requested.

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.

Top Solution Authors
Top Kudoed Authors