I have an existing Measure to calculate Project Management Time:
Project Management Time Unit =
CALCULATE(
SUM('Data'[Unit]),
FILTER('Data', 'Data'[Product - Title] = "Project Management Time")
)
The Data table also a column called "Action Code", Id like to create an IF statement that says:
Only calculate Project Management Time if the Action Code = "SK"
After some research, I think I may have to use a SWITCH function than an IF function but Im not sure. I cant seem to accurately build an accurate IF statement and have tried the following and Im seeing no data:
Project Management Time Unit 2 =
IF(
MAX('Data'[Action Code]) = "SK",
CALCULATE(
SUM('Data'[Unit]),
FILTER('Data', 'Data'[Product - Title] = "Project Management Time")
),
BLANK()
)
No need for IF
, instead you add the second condition to the FILTER
.
Like:
Project Management Time Unit =
CALCULATE(
SUM('Data'[Unit]),
FILTER(
'Data',
'Data'[Product - Title] = "Project Management Time") &&
'Data'[Action Code] = "SK"
)
)
You can also write it without the FILTER
:
Project Management Time Unit =
CALCULATE(
SUM('Data'[Unit]),
'Data'[Product - Title] = "Project Management Time") &&
'Data'[Action Code] = "SK"
)
And you can also have the conditions comma separated vs having &&
(which only can be used on the columns from the same table as each other).
Project Management Time Unit =
CALCULATE(
SUM('Data'[Unit]),
'Data'[Product - Title] = "Project Management Time"),
'Data'[Action Code] = "SK"
)