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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Aydeedglz
Helper V
Helper V

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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