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
karkar
Helper III
Helper III

DISTINCT VALUE

Hello,

 

How can I get unique value per ID from the below example? Currently it is giving the count of meas_value.

i tried to change it to Calculate(DISTINCTcount(Query1[value]), in the below formulae and it did not work

Total Count = Calculate(count(Query1[value]),

                       Filter(ALL(Query1[Admission_Hours]),Query1[Admission_Hours] >72))

 

ID     value

101    0

101    0

101    0

101    0

101    0

101    0

101    0

 

Currently the output is (since its counting 7 times)

ID    Value

101   7

 

WANT:

ID   Value

101   0

 

1 ACCEPTED SOLUTION

@karkar,


Please check if the following DAX returns your expected result.

Total Count = Calculate(max(Query1[value]),Filter(ALL(Query1[Admission_Hours]),Query1[Admission_Hours] >72))

Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @karkar,

You should do the distinct count on the ID column not on the value because it's what you want to count not the value column.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Like THIS?

 

Total Count = Calculate(DISTINCTcount(Query1[ID]),

                       Filter(ALL(Query1[Admission_Hours]),Query1[Admission_Hours] >72))

 

But I ALSO WANT TO SHOW THE UNIQUE "VALUES" AN id CONTAINS

Currently the output is (since its counting 7 times)

ID    totalcount

101   7

 

WANT:

ID   totalcount

101   0      (DISTINCT VALUE FOR EACH 'ID')

 

@karkar,


Please check if the following DAX returns your expected result.

Total Count = Calculate(max(Query1[value]),Filter(ALL(Query1[Admission_Hours]),Query1[Admission_Hours] >72))

Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.