Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dwhittaker1
Helper I
Helper I

count number of occurrences when value is greater than 0

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 orderValue
A-1
A-2
A4
A5
B6
B-3
1 ACCEPTED 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...

View solution in original post

5 REPLIES 5
dwhittaker1
Helper I
Helper I

@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.

Hey @dwhittaker1 ,

 

how do you analyze?

For me it works:

selimovd_0-1708464278922.png

 

Best regards

Denis

@selimovd  There is also a purchase order line, see below. sorry for the confusion

 

Purchase orderPurchase order lineTotal
A1-1
A2-2
A34
A45
B16
B27
B3-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...

selimovd
Super User
Super User

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.