Forum Discussion
Anonymous
7 years agoNot applicable
Count based on measure outcome
Hey guys I have a measure that substracts costs from income:
Profit = SUM(table1[Total budget]) - sum(table2[Costs])
Now, in a new measure, I want to count the amount of rows (ID's) that are profitable
Now, in a new measure, I want to count the amount of rows (ID's) that are profitable
Id's profitable = CALCULATE(DISTINCTCOUNT('Table1'[ID]); FILTER('Measures'; 'Measures'[Profit] > 0)
This did not seem to work: The measure counts the total of present ID's, rather than taking into account ID's that have profit > 0. Any clue what to do?
This did not seem to work: The measure counts the total of present ID's, rather than taking into account ID's that have profit > 0. Any clue what to do?
Anonymous
Try this one
Measure = COUNTROWS ( FILTER ( VALUES ( 'Table1'[ID] ), [Profit] > 0 ) )
Hi Anonymous ,
Not sure if you'd like to get this one:
Profit = CALCULATE(SUM(Table1[Total budget])-SUM(Table2[Costs]),FILTER(Table2,[ID]=MAX(Table1[ID])))
Measure = CALCULATE(DISTINCTCOUNT('Table1'[ID]),FILTER(Table1,[Profit]>0))
3 Replies
- Zubair_Muhammad
Community Champion
Anonymous
Try this one
Measure = COUNTROWS ( FILTER ( VALUES ( 'Table1'[ID] ), [Profit] > 0 ) )
- v-diye-msft
Community Support
Hi Anonymous ,
Not sure if you'd like to get this one:
Profit = CALCULATE(SUM(Table1[Total budget])-SUM(Table2[Costs]),FILTER(Table2,[ID]=MAX(Table1[ID])))
Measure = CALCULATE(DISTINCTCOUNT('Table1'[ID]),FILTER(Table1,[Profit]>0)) - AnonymousNot applicable
Thanks for the replies guys! The first solution worked perfectly (countrows).