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
zoveress
Regular Visitor

Calculating number of non unique values

Hello,

 

I am being puzzled with a solution here. I have a table with 2 columns, one of them shows the date when the date snapshot was taken the other shows a process if it was running:

 

dax001.png

 

If all 3 processes are running at the same time we can say that the application is 100% available, if only 2 or 1 processes running we can say that the application is not available. I would like to see an output like this:

 

9/12/2017 1:13:00 PM | 3

9/12/2017 1:14:00 PM | 3

9/12/2017 1:15:00 PM | 3

9/12/2017 1:16:00 PM | 1

9/12/2017 1:17:00 PM | 1

9/12/2017 1:16:00 PM | 1

9/12/2017 1:18:00 PM | 1

 

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Hi @zoveress,

 

Based on your description, I think summarize function will suitable for your requirement.
Use the data column as the group column, then summary stats column by distinct count function.

 

Table formula:

Summary table= SUMMARIZE('Table','Table'[DateTime],"Distinct",DISTINCTCOUNT('Table'[Status]))

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

You want DISTINCTCOUNT: https://msdn.microsoft.com/en-us/library/gg492142.aspx


@ 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...

I got that far myself I just do not know how to group the counts by date?

Just create a table visualization and put your date and your measure in it. It will group automagically. Or, you could use SUMMARIZE to create a new table.


@ 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...

I actually have 1470 unique dates. I need all of them grouped. I need a new table with the 1470 unique dates and the number of processes active at that time next to them. By the way I am new to this so any help code-wise would be appreciated. Like this:

 

9/12/2017 1:13:00 PM | 3

9/12/2017 1:14:00 PM | 3

9/12/2017 1:15:00 PM | 3

9/12/2017 1:16:00 PM | 1

9/12/2017 1:17:00 PM | 1

9/12/2017 1:16:00 PM | 1

9/12/2017 1:18:00 PM | 1

...... 1470

 

In SQL you would use count and groupby but what is the syntax for DAX?

 

 

Hi @zoveress,

 

Based on your description, I think summarize function will suitable for your requirement.
Use the data column as the group column, then summary stats column by distinct count function.

 

Table formula:

Summary table= SUMMARIZE('Table','Table'[DateTime],"Distinct",DISTINCTCOUNT('Table'[Status]))

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Many thanks for the answer we are half way there. Now it creates a list of dates but doesn't count the processes correctly. It counts 3 even if only one process was running at that time. Any ideas? 🙂

 

halfwaydone.png

Oh sorry my bad I used a different table for the second value, it works now with the following formula:

 

done_deal_formula.png

 

Summary table =  SUMMARIZE('CALC_CaptureDateList','CALC_CaptureDateList'[Date],"Distinct",DISTINCTCOUNT(CALC_CaptureDateList[Process]))

 

Many thanks for the help!

 

 

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
Top Kudoed Authors