Forum Discussion
dw700d
3 years agoPost Patron
distinct count aggregate
Good day all,
I am trying to create a measure that calculates the distinct count of Circuits with a profit greater than 0. I am using the measure below. The measure appears to be evaluating on a row by row basis. as a result it is telling me that there are 2 Circuits with a profit greater than 0. but I want the measure to evaluate the total profit for the circuit . Based on my data below the measure should return "1" because Circuit A has a -1,115 profit and Circuit C has a 1,789
Count of Profit Circuit =
CALCULATE(DISTINCTCOUNT('job'[Circuit #]),FILTER('job','job'[ Profit]>0))
| Circuit # | Date | .Revenue | Expense | Profit |
| A | 5/1/2022 0:00 | 108 | 299 | -191 |
| A | 6/1/2022 0:00 | 108 | 299 | -191 |
| A | 10/1/2022 0:00 | 115 | 299 | -184 |
| A | 11/1/2022 0:00 | 115 | 299 | -184 |
| A | 12/1/2022 0:00 | 115 | 299 | -184 |
| A | 7/1/2022 0:00 | 116 | 299 | -183 |
| A | 8/1/2022 0:00 | 116 | 299 | -183 |
| A | 9/1/2022 0:00 | 119 | 299 | -180 |
| A | 2/1/2022 0:00 | 109 | 249 | -140 |
| A | 3/1/2022 0:00 | 109 | 249 | -140 |
| A | 1/1/2022 0:00 | 437 | 249 | 188 |
| A | 4/1/2022 0:00 | 756 | 299 | 457 |
| C | 4/1/2022 0:00 | 800 | 758 | 42 |
| C | 5/1/2022 0:00 | 820 | 758 | 62 |
| C | 6/1/2022 0:00 | 830 | 758 | 72 |
| C | 7/1/2022 0:00 | 900 | 758 | 142 |
| C | 8/1/2022 0:00 | 800 | 758 | 42 |
| C | 9/1/2022 0:00 | 800 | 758 | 42 |
| C | 2/1/2022 0:00 | 830 | 632 | 198 |
| C | 3/1/2022 0:00 | 800 | 632 | 168 |
| C | 10/1/2022 0:00 | 900 | 379 | 521 |
| C | 1/1/2022 0:00 | 300 | 100 | 200 |
| C | 11/1/2022 0:00 | 200 | 0 | 200 |
| C | 12/1/2022 0:00 | 100 | 0 | 100 |
dw700d Try:
Count of Profit Circuit version 2 = COUNTROWS( FILTER( SUMMARIZE( 'Inventory', [Circuit #], "_Profit", SUM(Inventory[Profit]) ), [_Profit] > 0 ) )
3 Replies
- Greg_DecklerCommunity Champion
dw700d Try:
Measure = COUNTROWS( FILTER( SUMMARIZE( 'Table', [Circuit], "__Profit", SUM('Table'[Profit]) ) [__Profit] > 0 ) )- dw700dPost Patron
Greg_Deckler thank you for your help. I am not quite sure what I am doing wrong. Any thoughts
Count of Profit Circuit version 2 =COUNTROWS(FILTER(SUMMARIZE('Inventory',[Circuit #],"_Profit", SUM(Inventory[Profit]))[_Profit], SUM(Inventory[Profit]))[_Profit] > 0))- Greg_DecklerCommunity Champion
dw700d Try:
Count of Profit Circuit version 2 = COUNTROWS( FILTER( SUMMARIZE( 'Inventory', [Circuit #], "_Profit", SUM(Inventory[Profit]) ), [_Profit] > 0 ) )