Forum Discussion

pbijess857's avatar
pbijess857
Frequent Visitor
4 years ago
Solved

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...
  • VahidDM's avatar
    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/