Forum Discussion
pbijess857
4 years agoFrequent Visitor
Multiply Sum with Average
Hello. I am trying to figure out how to get this to work in Power BI. The rows on my table represent tickets with a number value (hours of work.) This table is joined with a separate table that cont...
- 4 years ago
Hi pbijess857
Try this code to add a new table:
Table 2 = VAR _A = ADDCOLUMNS ( SUMMARIZE ( 'Table', 'Table'[Group], 'Table'[Team], "SUM Hours of Works", SUM ( 'Table'[Hours of Work] ), "AVG Hours Available", AVERAGE ( 'Table'[Team Hours Available] ) ), "Sum Points / AVG Capacity", [SUM Hours of Works] / [AVG Hours Available] ) RETURN ADDCOLUMNS ( GROUPBY ( _A, [Group], "SUM Hours of Works", SUMX ( CURRENTGROUP (), [SUM Hours of Works] ), "SUM AVG Hours Available", SUMX ( CURRENTGROUP (), [AVG Hours Available] ) ), "Work/Available", [SUM Hours of Works] / [SUM AVG Hours Available] )output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
VahidDM
4 years agoSuper User
Hi pbijess857
Try this code to add a new table:
Table 2 =
VAR _A =
ADDCOLUMNS (
SUMMARIZE (
'Table',
'Table'[Group],
'Table'[Team],
"SUM Hours of Works", SUM ( 'Table'[Hours of Work] ),
"AVG Hours Available", AVERAGE ( 'Table'[Team Hours Available] )
),
"Sum Points / AVG Capacity", [SUM Hours of Works] / [AVG Hours Available]
)
RETURN
ADDCOLUMNS (
GROUPBY (
_A,
[Group],
"SUM Hours of Works", SUMX ( CURRENTGROUP (), [SUM Hours of Works] ),
"SUM AVG Hours Available", SUMX ( CURRENTGROUP (), [AVG Hours Available] )
),
"Work/Available", [SUM Hours of Works] / [SUM AVG Hours Available]
)
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
pbijess857
4 years agoFrequent Visitor
This looks like it has me back on the right track. Thank you for the help!