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
adoster
Resolver I
Resolver I

Help with DistinctCount by Date

Trying to find the distinct count of procedures by date.

 

DateNameProcedure Display NameDistinct PDN
11/8/2021Mickey MouseProcedure A1
11/8/2021Mickey MouseProcedure B1
11/9/2021Mickey MouseProcedure A1
11/9/2021Mickey MouseProcedure B1

 

Desired Result:

DateDistinct Count of PDN
11/8/20211
11/9/20211
Total2

 

I tried a simple measure doing a discount count on the NAME which returns a value of 1

Measure1 = DISTINCTCOUNT('Table'[Name])

 

 

Desired Results with Multiple People across 3 days

DateNameProcedure Display NameDistinct PDN
11/8/2021Donald DuckProcedure A1
11/8/2021Donald DuckProcedure B1
11/8/2021Mickey MouseProcedure A1
11/8/2021Mickey MouseProcedure B1
11/9/2021Donald DuckProcedure A1
11/9/2021Donald DuckProcedure B1
11/9/2021Mickey MouseProcedure A1
11/10/2021Mickey MouseProcedure A1
  TOTAL5

 

 

1 ACCEPTED SOLUTION

Hi @adoster 

Try to create this measure to achieve your goal.

Measure = 
VAR _SUMMARIZE = SUMMARIZE('Table','Table'[Date],"DISTINCT COUNT",DISTINCTCOUNT('Table'[Name]))
RETURN
SUMX(FILTER(_SUMMARIZE,[Date]<= MAX('Table'[Date])),[DISTINCT COUNT])

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

5 REPLIES 5
adoster
Resolver I
Resolver I

I believe that I need distinct count based on Name & Procedure.

If one Name has 5 procedures on 1 day = 1 volume

If two Names each have 5 procedures on 1 day = 2 volume

If two Names each have 5 procedures on 2 days = 4 volume

If three Names each have 5 procedures on 2 days = 6 volume

 

In the first example above I did a Distinct Count on Name. The Total count give me 1 instead of the desired 2

Hope this helps

 

Hi @adoster 

Try to create this measure to achieve your goal.

Measure = 
VAR _SUMMARIZE = SUMMARIZE('Table','Table'[Date],"DISTINCT COUNT",DISTINCTCOUNT('Table'[Name]))
RETURN
SUMX(FILTER(_SUMMARIZE,[Date]<= MAX('Table'[Date])),[DISTINCT COUNT])

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi RicoZhou,

I ran across one snag on the solution I was wondering if you might be able to help.

The Table View shows the correct total count (5) that I was looking for, but it doesn't work on a Graph Visualization. It still shows the total procedure count (8)

 

To try and solve this I added a column which gives a Rank to each Procedure Name. My thought is that the Graph would only count the highest rank and then ignore everything after.

 

Sorry if this is a totally separate issue and I can create a new post if needed 🙂

 

Example of volume that would show on a graph:

 

DateNameProcedure Display NameDistinct PDNRank
11/8/2021Donald DuckProcedure A11
11/8/2021Donald DuckProcedure B12
11/8/2021Mickey MouseProcedure A11
11/8/2021Mickey MouseProcedure B12
11/9/2021Donald DuckProcedure A11
11/9/2021Donald DuckProcedure B12
11/9/2021Mickey MouseProcedure A11
11/10/2021Mickey MouseProcedure B1

1

 

  Desired Results
 Procedure Display NameCount by Rank
11/8/2021Procedure A2
11/8/2021Procedure B0
11/9/2021Procedure A2
11/9/2021Procedure B0
11/10/2021Procedure A0
11/10/2021Procedure B1
Total 5

 

Thanks for any assistance.

 

This worked! Thank you so much!

lbendlin
Super User
Super User

You need to decide what you are actually trying to measure. Distint count of name, distinct count of procedure, or distinct count of [Name]+[Procedure]  ?

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.