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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

DISTINCT COUNT WITH FILTER

Hi, I am trying to create a measure that is going ot divide the total number of ditint rows by the total number of distint rows that are in the category "A" to see the % of rows that are category "A".

I have tried different formulas 

 

DD_Collector_%_OpenTransactions =
VAR COLL_TRANSACTIONS = CALCULATE(FILTER(Table1,Table1[a_A/B] = "A"), DISTINCTCOUNT(Table1[Transactions]))
VAR COLL_TRANSACTIONS_A = CALCULATE(DISTINCTCOUNT(Table1[Transactions]), FILTER(ALL(Table1[a_A/B], Table1[Status]),Table1[a_A/B] = "A" && Tabe1[Status] = "Open"))
VAR COLL_TRANSACTIONS_A2 = CALCULATE(DISTINCTCOUNT(Table1[Transactions]), Table1[a_A/B] = "A" && Table1[Status] = "Open")

RETURN
COLL_TRANSACTIONS_A COLL_TRANSACTIONS
 
COLL_TRANSACTIONS_A and COLL_TRANSACTIONS_A2 are the same I just did a try bith both but they don't work
1 REPLY 1
lbendlin
Super User
Super User

You will want to use DIVIDE()  to protect against cases of division by zero.

 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.