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

Count unique values with criteria for each day

Hello everyone,

Please I want a way to make a distinct count by criteria for each day during the month.

 

Example: 

aboutayeb_0-1646418387540.png

Thank you in advance.

1 ACCEPTED SOLUTION
rocky09
Solution Sage
Solution Sage

sorry, it was the wrong table.
here is the correct one.

DistinctCountofSameID on Same day = 
           CALCULATE(DISTINCTCOUNT( 'db'[Identfier]),
                db[STATUS]="Accepted",
               KEEPFILTERS('db'[STATUS]="Accepted"))

View solution in original post

11 REPLIES 11
rocky09
Solution Sage
Solution Sage

I am not sure if I understood your question.

We have created a custom column that will create the Identifier. So, it should work. May be you can test with some more data. Btw, first try then see, if the above one solution that I have provided is not working, you can wait for some other's solution.

Cheers

rocky09
Solution Sage
Solution Sage

sorry, it was the wrong table.
here is the correct one.

DistinctCountofSameID on Same day = 
           CALCULATE(DISTINCTCOUNT( 'db'[Identfier]),
                db[STATUS]="Accepted",
               KEEPFILTERS('db'[STATUS]="Accepted"))
Anonymous
Not applicable

The solution works (y)?
Last question in case there are several criteria it will be like this?

 

DistinctCountofSameID on Same day =

           CALCULATE(DISTINCTCOUNT( 'db'[Identfier]),

                         db[STATUS]="Accepted", db[criteria2]="criteria2",

                         KEEPFILTERS('db'[STATUS]="Accepted",db[criteria2]="criteria2",))

rocky09
Solution Sage
Solution Sage

Try this:
Create a Calculated Column

 

Identfier = 
CONCATENATE('db'[ID CLT] ,'db'[DATE])

 

then create this measure

 

DistinctCountofSameID on Same day = 
           CALCULATE(DISTINCTCOUNT( 'db'[Identfier]),
                sumtable[STATUS]="Accepted",
               KEEPFILTERS('db'[STATUS]="Accepted"))
               

 

 

rocky09_0-1646477869890.png

 

 
Anonymous
Not applicable

Thanks a lot.
What is "sumtable", for me it's grey?

Anonymous
Not applicable

Failed to resolve the name "sumtable". This is not a valid table, function or variable name.

Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table.  Create a relationship from the Date column of the Data Table to the Date column of the Calendar Table.  To your Table visual, drag Date column from the Calendar Table.  Write this measure

Measure = calculate(distinctcount(Data[ID CLT]),Data[Statut]="Accepted")

Alternatively, you may create a slicer of Statut and select Accepted in that slicer.  Then write this measure

Measure = distinctcount(Data[ID CLT])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello,

I didn't quite understand the solution, but in the end I want a result like this

aboutayeb_0-1646470942669.png

Thank you very much.

Hi,

What problem do you face when implementing my solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rocky09
Solution Sage
Solution Sage

So as per your above example, for 3rd, you want to see 3 as Accepted and for 4th 3 as Accepted?

Anonymous
Not applicable

First of all, thank you for your answer.
No I want the same result.
for the 3rd, I want to see 2 as accepted and for the 4th 2 as accepted.

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.