Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I would like to create a calculated column/measure that counts the number of times a purchase order appears in a column when the "value" is greater than 0. so for example, Purchase order "A" would return a value of 2 and Purchase order "B" would return a value of 1
| Purchase order | Value |
| A | -1 |
| A | -2 |
| A | 4 |
| A | 5 |
| B | 6 |
| B | -3 |
Solved! Go to Solution.
@dwhittaker1 if you have mulitple other columns that you show or additional sort by columns, then remove the filter context except for the one of Purchase Order:
# Orders greater than 0 =
CALCULATE(
COUNTROWS(myTable),
ALLEXCEPT(myTable, myTable[Purchase order]),
myTable[Value] > 0
)
Next time please mention all the details from the beginning as the approaches change with changing a filter context...
@selimovd thank you for your response, this approach excludes the negatives but it does not give me the cumulative total for each purchase order. For example, Purchase order "A" should return a value of 2 becuase there are two purchase orders with a positive value but your approach currently returns a value of 1.
@selimovd There is also a purchase order line, see below. sorry for the confusion
| Purchase order | Purchase order line | Total |
| A | 1 | -1 |
| A | 2 | -2 |
| A | 3 | 4 |
| A | 4 | 5 |
| B | 1 | 6 |
| B | 2 | 7 |
| B | 3 | -3 |
@dwhittaker1 if you have mulitple other columns that you show or additional sort by columns, then remove the filter context except for the one of Purchase Order:
# Orders greater than 0 =
CALCULATE(
COUNTROWS(myTable),
ALLEXCEPT(myTable, myTable[Purchase order]),
myTable[Value] > 0
)
Next time please mention all the details from the beginning as the approaches change with changing a filter context...
Hey @dwhittaker1 ,
try the following measure:
# Orders greater than 0 =
CALCULATE(
COUNTROWS(myTable),
myTable[Value] > 0
)
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 39 | |
| 38 | |
| 21 |
| User | Count |
|---|---|
| 176 | |
| 131 | |
| 118 | |
| 82 | |
| 54 |