Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Measure with filters

Hi! I have a table called DM_ACTIVITY with several columns two of which are activity_duration and activity_group.  I would like to create a measure in the report mode that sums up all the activity_d...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

     

    Try this measure

     

     

    Total =
    VAR a =
        CALCULATE (
            SUM ( 'DM_ACTIVITY'[activity_duration] ),
            'DM_ACTIVITY'[activity_group]
                IN {
                "RIG",
                "D1C",
                "D2C"
            }
        )
    RETURN
        DIVIDE (
            a,
            24
        )

     

    or

     

    Total =
    VAR a =
        SUMX (
            FILTER (
                'DM_ACTIVITY',
                'DM_ACTIVITY'[activity_group]
                    IN {
                    "RIG",
                    "D1C",
                    "D2C"
                }
            ),
            'DM_ACTIVITY'[activity_duration]
        )
    RETURN
        DIVIDE (
            a,
            24
        )

     

     

     

    Regards,

    Harsh Nathani