Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Counting measures

Hi,

 

I have a report that compares my company's prices with our competitors. 

 

I have created a list with the following dimensions and measures: Product; Our price; lowest competitor price; Difference between the prices.

That table works just fine.

 

But what I also want to do is to count the number of products where the Difference > 0. In other words I want to count "measures" based on if its positive or negative. 

But when going through all the different "Counts" (Count, Countx,Countax etc) it seems that only column values can be counted. How can I create a measure that count measures?  

 

 

  • You could try

    Num diff > 0 = COUNTROWS( FILTER( 'Table', [Price difference] > 0 ) )

4 Replies

  • You have to try The Summerization and Countrow Function for that

  • You could try

    Num diff > 0 = COUNTROWS( FILTER( 'Table', [Price difference] > 0 ) )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks! But an additonal question: if I want to group these into price diff > 10%, price diff > 5% etc. How do I do that? Can I use the switch-formula for that?

     

     

    • johnt75's avatar
      johnt75
      Super User

      I would do that as a calculated column, e.g.

      Diff grouping =
      var pctDiff = DIVIDE( 'Table'[Our price] - 'Table'[Their price], 'Table'[Our price])
      return SWITCH( TRUE(),
      pctDiff >= 0.5, "> 50%",
      pctDiff >= 0.25, "> 25%",
      pctDiff >= 0.1, "> 10%",
      "< 10%"
      )