Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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...
  • Zubair_Muhammad's avatar
    7 years ago

    Anonymous 

     

    Try this one

     

    Measure =
    COUNTROWS ( FILTER ( VALUES ( 'Table1'[ID] ), [Profit] > 0 ) )
    
  • v-diye-msft's avatar
    7 years ago

    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))