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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
astano05
Helper III
Helper III

Distinct Row Count with filter for Transaction Amount

I'm looking to get the distinct count of rows when the transaction amount is below a certain value. It also will not let me place a visual level filter on the card of the count.

 

I try 

CALCULATE(DISTINCTCOUNT('Transaction History'[ORDER_NUMBER]),[Transaction Amount]<500) but i get this error: "A function "Calculate" has been used in a True/False expression that is used as a table filter expression. This is not allowed."
 
I also tried 
Order under 500 = countrows(DISTINCT(SELECTCOLUMNS('Transaction History',"under 500",[Transaction Amount]<500))); but it gives me an incorrect count. 
 
I have a table as below:
Order NumbercustomerSum of Order Amount
1A1000
2A250
3A100
4A600
5B200
6B1000

I want a card to show the number of orders below $500 (3). 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@astano05 , Assuming Sum of Order Amount is a measure

Create a new measure

countx(filter(values('Transaction History'[ORDER_NUMBER]), [Sum of Order Amount]<500),[ORDER_NUMBER])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@astano05 , Assuming Sum of Order Amount is a measure

Create a new measure

countx(filter(values('Transaction History'[ORDER_NUMBER]), [Sum of Order Amount]<500),[ORDER_NUMBER])

Yes this works perfectly! Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.