Forum Discussion
Count if with a measure
Hi
Is it possible to create a count if with a measure?
In the image below I have a capacity planning process with different activities (drilled down).
The rule is simple, if the % on each of the rows is above or equal to 0.8% then 1, else 0.
Also it should make the sum of the 1's for the process. Hence the activities: capacity assessment, demand alignment and standard routines are the only ones who meet the criteria and should have a 1 next to each row, and the capacity assessment process should have a 3 (the sum of the 3 activities with a 1)
How can this be done in a dax?
The % column of the image has the following dax:
Non Duplicate Hours Process/Activity 3 =
DIVIDE(
[Non Duplicate Hours Process/Activity Numerator],
[Non Duplicate Hours Process/Activity Denominator 3])
Thanks.
13 Replies
- lbendlin
Super User
You cannot measure a measure directly. Either materialize it first, or create a separate measure that implements the entire business logic.
- o59393
Post Prodigy
Hi lbendlin
With the second option you mention.
The dax I am trying to reference has these 2 pieces:
Non Duplicate Hours Process/Activity Numerator = SUMX( SUMMARIZE( Template, Template[Merged], Template[Hours by Year] ), Template[Hours by Year] )Could I have the if statetement incorporating these 2 measures within the dax?
thanks.
- o59393
Post Prodigy
- ITManuel
Responsive Resident
Hi o59393 ,
not sure if I understood correctly, but if you want to count the facets which have & equal or greater to 0,8% you can try the following:
Count IF = VAR _T1 = FILTER ( ADDCOLUMNS ( VALUES ( Table[Facet] ), "@%", [Non Duplicate Hours Process/Activity 3] ), [@%] >= 0.8 ) VAR _Result = COUNTROWS ( _T1 ) RETURN _T1