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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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