cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Gather a sum function and place the value in another row in a table

Hi everyone, 

 

Have a issue I try to solve. Right now in the data I collect there's a column for Scope with 4 different options, and only one of those options "Work" there is a value (hours). That scope is tied to a unique ID, and there can be lots of hours submitted on different dates on to one unique ID. Another Scope value is "Finished Work" which always has 0 hours.  I would like to create a formula so it gathers the sum of hours and place it in "Finished Work" row just for that unique ID. ("Finished work" is tied to "Work", so it has the same ID).

Example on the picture below:

Skärmavbild 2021-11-23 kl. 14.22.28.png

Here I want to have the total hours next to "Finished Work"

1 ACCEPTED SOLUTION

Accepted Solutions
Syndicate_Admin
Administrator
Administrator

Hi @Scaffnull 

 

You can create below measure and put it in the matrix as Values field.

Total Hours = IF(SELECTEDVALUE('Table'[Scope])="Finished work", CALCULATE(SUM('Table'[Hours]),ALL('Table'[Date])), SUM('Table'[Hours]))

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

@Scaffnull Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

@Greg_Deckler Thank you for your reply! So the source of the data comes from a report system. Where the workers does a job and can choose different types of work, depending on the type of work it records in the column from the excel sheet. So example, ID 100 they did "Hours" (records in the scope column) and value is 25 hours. This can be repeated so the next day they did another job under ID 100 with "Hours" 55. So now on two different rows it has 25 and 55 hours. On day 3 they "Finished Work" and no hours is put in. I would like to have the 80 hours worked placed on "Finished Work". And this repeated for example ID 240 that has 120 value based on the hours worked.

 

Skärmavbild 2021-11-23 kl. 17.19.49.png

 So based on this picture have 40 + 220 stand as 260 on the last line. Hope that makes better sense 🙂 

Syndicate_Admin
Administrator
Administrator

Hi @Scaffnull 

 

You can create below measure and put it in the matrix as Values field.

Total Hours = IF(SELECTEDVALUE('Table'[Scope])="Finished work", CALCULATE(SUM('Table'[Hours]),ALL('Table'[Date])), SUM('Table'[Hours]))

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

@v-jingzhang Perfect! This worked just like I wanted to, just had to rename to the correct tables 🙂 thank you very much!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (1,668)