Forum Discussion

Kish1999's avatar
Kish1999
Icon for Helper II rankHelper II
4 years ago
Solved

Get Hours for each project

Hello All, I have a scenario where I need to get the hours for each of the Projects. The project details are present in Projects table The hours are present in hours table and these are present for...
  • johnt75's avatar
    johnt75
    3 years ago

    Instead of the relationship, you could create the Project Hours measure like

    Project Hours =
    VAR ProjectKeys =
        CALCULATETABLE (
            VALUES ( 'Project Key'[Key] ),
            TREATAS ( VALUES ( Project[Project Name] ), 'Project Keys'[Project Name] )
        )
    RETURN
        CALCULATE ( SUM ( Hours[Hours] ), TREATAS ( ProjectKeys, Hours[Key] ) )