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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DemoFour
Responsive Resident
Responsive Resident

Count ID once when it has many values in the table

I have a series of questions (34) that link to a set of 4 KPI's categories KPI 1, KPI 2, KPI 3 & KPI4.

Each KPI has more than 1 question related to it, which a client can answer yes to.

Each client can answer yes to multiple questions that link to the same KPI from the 34 questions asked.

I would like to count the number of clients that meet the KPI only once

 

What is the best way to set this out?

 

I have a table of all the questions with a yes by the questions they answered yes to. Ech client can anwer multpul questions but only the yes is brought into the table. 

I have a static table that references which question relates to the KPI indicated by a 1 in the table for each question relating to the KPI.

 

In the visual you can see the KPI 1 and the number of questions related to this.

 PBI3.PNG

The visual is just a table. Count of question ID is made by dropping in question ID twice and then changing one to count. KPI is from a static table and filtered to show the 1 next to the question ID

 

The help I need is, I have 8 clients who have answered one or more questions and I want to show a visual of KPI 1 and a count of 8 next to it

 

So the return that I want from my measure is 8 individual clients answered yes to a question that relates to the KPI 1

 

Any help would be greatly received, as I am new to DAX and still learning as I go along and this is a bit more complex to calculate

1 ACCEPTED SOLUTION

Hi @Greg_Deckler 

 

Thanks for the tip!

 

In the end I went with 

 

KPI 1 Count = 
 CALCULATE(
     DISTINCTCOUNTNOBLANK( 'Support Needs'[Client Application ID] ),
     'Support Needs'[KPI 1] = 1
 )

 

This worked for me and gave the desired result.

 

 

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

So in general you would use SUMMARIZE or you could use DISTINCT along with COUNTROWS or even DISTINCTCOUNT.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Thanks for the tip!

 

In the end I went with 

 

KPI 1 Count = 
 CALCULATE(
     DISTINCTCOUNTNOBLANK( 'Support Needs'[Client Application ID] ),
     'Support Needs'[KPI 1] = 1
 )

 

This worked for me and gave the desired result.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors