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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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])))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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])))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@Anonymous , Not tested, But try like

 

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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