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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rabur116
Frequent Visitor

Distinct Count of Object Per Type and Date

Hi,

 

I have this table where I need to count the Grand Total number of object by date:

Object NameObject TypeDate
abcvm1ahv3/26/2020
abcvm2vmw3/26/2020
bcdvm1ahv3/25/2020
bcdvm1ahv3/25/2020
bcdvm1ahv3/24/2020
bcdvm1vmw3/24/2020
cdwvm1ahv3/24/2020

 

An object should be counted only once per day if it's of the same object type. The answer should be:

DateahvvmwTotal
3/26/2020112
3/25/2020101
3/24/2020213
  Grand Total6

 

I am using a "Card" visualization to show the Grand Total as I filter the date/s. Please let me know the correct Measure that I can use for the "Card".

 

Thanks in advance!

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

v-easonf-msft
Community Support
Community Support

Hi , @Rabur116 

Try steps as below:

1.create a calculate table:

Table 2 = DISTINCT('Table'[Object Type])

2.create a mesure as below

value1 =
SUMX (
    GROUPBY (
        FILTER ( 'Table', 'Table'[Object Type] IN DISTINCT ( 'Table 2'[Object Type] ) ),
        'Table'[Date],
        'Table'[Object Type]
    ),
    IF (
        ISBLANK ( CALCULATE ( DISTINCTCOUNT ( 'Table'[Object Name] ) ) ),
        0,
        CALCULATE ( DISTINCTCOUNT ( 'Table'[Object Name] ) )
    )
) + 0

It will show as below:

58.png

 

Here is  a demo

pbix attached

 

Best Regards,
Community Support Team _ Eason
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

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi , @Rabur116 

Try steps as below:

1.create a calculate table:

Table 2 = DISTINCT('Table'[Object Type])

2.create a mesure as below

value1 =
SUMX (
    GROUPBY (
        FILTER ( 'Table', 'Table'[Object Type] IN DISTINCT ( 'Table 2'[Object Type] ) ),
        'Table'[Date],
        'Table'[Object Type]
    ),
    IF (
        ISBLANK ( CALCULATE ( DISTINCTCOUNT ( 'Table'[Object Name] ) ) ),
        0,
        CALCULATE ( DISTINCTCOUNT ( 'Table'[Object Name] ) )
    )
) + 0

It will show as below:

58.png

 

Here is  a demo

pbix attached

 

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

Hi, both the first person's solution and your solution work. Thanks a lot for the help!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Rabur116 

Try like

Sumx(summarize(Table[Date],table,[ Object Type]"_dist",distinct(Table[Object Name])),[_dist])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Your solution works! Thanks a lot for the help.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.