Forum Discussion
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
- mh2587Super User
You have to try The Summerization and Countrow Function for that
- johnt75Super User
You could try
Num diff > 0 = COUNTROWS( FILTER( 'Table', [Price difference] > 0 ) ) - AnonymousNot 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?
- johnt75Super 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%" )