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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chisholmconnor
Regular Visitor

DAX Sum column based on condition in other columns in same table

SumQuestion.PNG

Hello,

 

I have a table with a column of UserIDs that only appear once each of which has a ManagerID as well as a value of Total # of Assets. I want to for each UserID add their Total # of Assets with the Total # of Assets if they match with a ManagerID.

 

For example, UserID UDONEUM has 2 total assets right now but he is JOSWART's manager which he has 1154 assets. Therefore, UDONEUM should have a total of 1156 assets displayed in that last column # of Assets(same column).

 

I have tried multiple functions using SUMX, FILTER, CALCULATE, and SUM but cant seem to get the value I want. I tried

 

=SUMX(FILTER('2','2'[UserID] = '2'[Manager ID]),'2'[Total # of Assets])

=CALCULATE(SUM('2'[Total # of Assets]),FILTER('2','2'[UserID] = '2'[Manager ID]))

 

Thanks!

CC

1 ACCEPTED SOLUTION

@v-danhe-msft I found a DAX function to solve my issue

 

I used = CALCULATE(SUM('3'[# of Assets(total)]),FILTER('3', [Manager ID] = EARLIER('3'[UserID])))

 

Thanks for the help anyways,

CC

View solution in original post

3 REPLIES 3
v-danhe-msft
Employee
Employee

Hi @chisholmconnor,

Could you please tell me if the [Manage ID] has relationships with the [User ID]?

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-danhe-msft I found a DAX function to solve my issue

 

I used = CALCULATE(SUM('3'[# of Assets(total)]),FILTER('3', [Manager ID] = EARLIER('3'[UserID])))

 

Thanks for the help anyways,

CC

If I may ask, what does the 3 represent in your formula?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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