Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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_duration hrs filtered by three values in the activity_group column which are RIG, D1C and D2C.
activity_group column has text data type and doesn't summarize values.
activity_duration has decimal number data type and doesn't summarize values (tried Sum as well).
Why doesn't this measure work?
Solved! Go to Solution.
Hi @Alex_0201 ,
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
Hi @Alex_0201 ,
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
Hi @harshnathani Thanks! I used the first one.
What if I need add another filter (value "P") from another column (activity_class) in the same table?
what's wrong with this formula?
HI @Alex_0201 ,
Just a slight modification then.
Prod time =
VAR a =
CALCULATE (
SUM ( 'DM_ACTIVITY'[activity_duration] ),
FILTER (
'DM_ACTIVITY',
'DM_ACTIVITY'[activity_group]
IN {
"RIG",
"D1C",
"D2C"
}
&& 'DM_ACTIVITY'[activity_class]
IN {
"P"
}
)
)
RETURN
DIVIDE (
a,
24
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
Thank you very much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |