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
Anonymous
Not applicable

DAX help group by distinct count measure

Hello,

I am a recent user of PBI and i am struggling with some data.

I need help to write two measures:

- one measure that group by "bank" and count unique "process" with errors

- one measure that group by "bank" and count total number of unique process received

 

here is the table and the desired results:

Capture.PNG

 

Thank you in advance!

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create 2 measures

 

Result1 =

var _a = FILTER(ALLEXCEPT('Table','Table'[Bank]), 'Table'[ErrorType] <> BLANK())

RETURN
CALCULATE(DISTINCTCOUNT('Table'[Process]),_a)
 
 
 
Result2 = CALCULATE(DISTINCTCOUNT('Table'[Process]),ALLEXCEPT('Table','Table'[Bank]))

 

 

1.jpg

 

 

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,

 

I am also new to DAX. I was just wondering if we could use the following code for your 2nd requirement !

 

Table = SUMMARIZE(Sheet1,Sheet1[bank],"numb",DISTINCTCOUNT(Sheet1[process]))
 
Please let me know your inputs.
 
Thanks
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create 2 measures

 

Result1 =

var _a = FILTER(ALLEXCEPT('Table','Table'[Bank]), 'Table'[ErrorType] <> BLANK())

RETURN
CALCULATE(DISTINCTCOUNT('Table'[Process]),_a)
 
 
 
Result2 = CALCULATE(DISTINCTCOUNT('Table'[Process]),ALLEXCEPT('Table','Table'[Bank]))

 

 

1.jpg

 

 

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Anonymous
Not applicable

Hi @Anonymous 

DAX does a good job of using the context of what's in a table to group things for you. The DAX for what you're looking for is pretty simple, we just need to write a formula that counts the unique processes with errors, and then another similar formula for calculating just the unique processes.

Distinct Processes with Errors =
CALCULATE(
DISTINCTCOUNT(process number),
NOT(ISBLANK(error type))
)

Distinct Processes = 
DISTINCTCOUNT(process number)
Anonymous
Not applicable

Hello,

the code bellow didn't work 😞

NOT(ISBLANK(error type))

 

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.