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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Sum a Column by the Value in Another Column

Hi,

I'd like to sum the values in a column based on the value in another column. Here is an example of my data:

GeekyT_0-1608647158818.png

 

I'd like a new column which sums the Diff. Time for each Work Area. In this example the column would show 2hrs 31mins for black work area, 15mins for red work area and 1hr 9mins for blue work area. 

 

Here's the DAX I have currently, from an example I found on another thread on this board:

 

Column = CALCULATE(SUM('aseqdn (2)'[Diff. Time]),FILTER(ast,(RELATED(ast[Work Area])=EARLIER(RELATED(ast[Work Area])))))
 
But it isn't working (it's returning an error about their being a circular dependency). Can anyone spot what I;m doing wrong please?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You might have create a new column in aseqdn (2)

Work Area = related(ast[Work Area]) // refer other option in video https://www.youtube.com/watch?v=czNHt7UXIe8

 

and create a new column like

 

Column = CALCULATE(SUM('aseqdn (2)'[Diff. Time]),FILTER('aseqdn (2)',[Work Area]=EARLIER([Work Area])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

6 REPLIES 6
Iryna_K
Frequent Visitor

Try using the Time in State for Azure DevOps extension https://marketplace.visualstudio.com/items?itemName=SaaSJet.tis-azure .

It allows you to generate reports on time calculation in states/columns automatically.

It's not a Power BI solution, but you'll find it helpful.

Anonymous
Not applicable

.

amitchandak
Super User
Super User

@Anonymous , You might have create a new column in aseqdn (2)

Work Area = related(ast[Work Area]) // refer other option in video https://www.youtube.com/watch?v=czNHt7UXIe8

 

and create a new column like

 

Column = CALCULATE(SUM('aseqdn (2)'[Diff. Time]),FILTER('aseqdn (2)',[Work Area]=EARLIER([Work Area])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
amitchandak
Super User
Super User

@Anonymous , Not tested, But try like

 

Column = CALCULATE(SUM('aseqdn (2)'[Diff. Time]),allexcept(RELATEDTABLE(ast),ast[Work Area]))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak I have also just tried this with the resulting error, 

GeekyT_0-1608651372609.png

 

Anonymous
Not applicable

@amitchandak  Thanks for responding. Unfortunately I'm getting this error 'The ALLEXCEPT function expects a table reference for argument '1', but a table expression was used.'

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

October NL Carousel

Fabric Community Update - October 2024

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