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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DonRitchie
Frequent Visitor

Calculated Column to aggregate two aggregate measures along row level of detail in a matrix

Hi,

 

This is probably something really simple that I am brainfarting on because it is Monday, but how do I sum the sums of two measures in a calculated column that aligns with row level detail like a measure would?

 

This is the measure that works: 

 

Total Pay = sum(CSV[UnattachedSettlement Pay]) + sum (DATASET[AttachedSettlementPay])

 

 Producing this result:

RowsRowsValuesValuesValues
EmployeeWeek EndingAttachedSettlementPayUnattachedSettlementPayTotal Pay
Adam6/18/22400150550
 7/2/2205050
Bob6/4/228003001100
 6/11/22150001500
 6/18/221300501350
Chuck6/25/2218001501950
 7/2/22150001500

 

I want a Calculated Column that I can put in the Rows fields that produces this result:

RowsRowsRowsValuesValues
EmployeeWeek EndingTotalPayColumnAttachedSettlementPayUnattachedSettlementPay
Adam6/18/22550400150
 7/2/2250050
Bob6/4/221100800300
 6/11/22150015000
 6/18/221350130050
Chuck6/25/2219501800150
 7/2/22150015000

 

This does not work, creating the total pay for each driver in the entire database on every row:

TotalPayColumn = CALCULATE(sum(CSV[UnattachedSettlementPay]) + sum(Dataset[AttachedSettlementPay]))

 

This gives me an error, Cannot convert value 'Adam' of type Text to type True/False.:

TotalPayColumn = CALCULATE(sum(CSV[UnattachedSettlementPay]) + sum(Dataset[AttachedSettlementPay]),DriverCardinal[Driver])

 

This does not work, creating the total pay for each driver for the displayed weeks on every row (ie, both rows for Adam are 600):

TotalPayColumn = CALCULATE(sum(CSV[UnattachedSettlementPay]) + sum(Dataset[AttachedSettlementPay]),WeekCardinal[Week Ending])

 

I am sure it is some of those filter functions inside of Calculate, but I have been banging my head on this all morning.  Any help would be appreciated.  Thanks!

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @DonRitchie 

 

Based on your description, I created a simple sample and relationship :

vjianbolimsft_0-1657783682714.png

 

vjianbolimsft_1-1657783682716.png

 

vjianbolimsft_2-1657783682716.png

 

Here is the DAX of the calculate column:

 

TotalPayColumn = CALCULATE(SUM('CSV'[UnattachedSettlementPay]),FILTER('CSV',[Employee]=EARLIER('DATASET'[Employee])&&[Week Ending]=EARLIER('DATASET'[Week Ending]))) + [AttachedSettlementPay]

 

Then You can put the column in Value field to achieve your purpose.

Final output:

vjianbolimsft_3-1657783682718.png

 

If the result is not what you want, please give more details.

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @DonRitchie 

 

Based on your description, I created a simple sample and relationship :

vjianbolimsft_0-1657783682714.png

 

vjianbolimsft_1-1657783682716.png

 

vjianbolimsft_2-1657783682716.png

 

Here is the DAX of the calculate column:

 

TotalPayColumn = CALCULATE(SUM('CSV'[UnattachedSettlementPay]),FILTER('CSV',[Employee]=EARLIER('DATASET'[Employee])&&[Week Ending]=EARLIER('DATASET'[Week Ending]))) + [AttachedSettlementPay]

 

Then You can put the column in Value field to achieve your purpose.

Final output:

vjianbolimsft_3-1657783682718.png

 

If the result is not what you want, please give more details.

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@DonRitchie , Seem like you are trying to create a column have data from two tables, for that you have to copy values from other tables 

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.