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

COUNTDISTINCT VALUE FOR EACH HOUR, FOR EACH DAY

Hi all

I've got a table:

https://www.dropbox.com/s/7yawtwvpsjexnx1/FILE_EX.xlsx?dl=0

From this, I need of table as structured as:

month

day

hour(HH)

nr CONT--> nr of CONT for each hour, for each day

nr ops--> count distinct for each hour of the MATRICOLAs, for each day

 

here an example of the output reached:

monthdayhhnr contnr ops
91624013
91735113
91830217

Do you have any solution?

Thanks for your help

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous ,

 

You can first add new columns:

Month = MONTH(Foglio1[DATA])
Day = DAY(Foglio1[DATA])
HH = HOUR(Foglio1[DATA])

v-jingzhang_0-1600683154301.png

And then create a new table:

Table =
SUMMARIZE (
    Foglio1,
    Foglio1[Month],
    Foglio1[Day],
    Foglio1[HH],
    "nr CONT", COUNT ( Foglio1[cont] ),
    "nr ops", DISTINCTCOUNT ( Foglio1[MATRICOLA] )
)

v-jingzhang_1-1600683154303.png

Is this what you want?

 

Best Regards,

Community Support Team _ Jing Zhang

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

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous ,

 

You can first add new columns:

Month = MONTH(Foglio1[DATA])
Day = DAY(Foglio1[DATA])
HH = HOUR(Foglio1[DATA])

v-jingzhang_0-1600683154301.png

And then create a new table:

Table =
SUMMARIZE (
    Foglio1,
    Foglio1[Month],
    Foglio1[Day],
    Foglio1[HH],
    "nr CONT", COUNT ( Foglio1[cont] ),
    "nr ops", DISTINCTCOUNT ( Foglio1[MATRICOLA] )
)

v-jingzhang_1-1600683154303.png

Is this what you want?

 

Best Regards,

Community Support Team _ Jing Zhang

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

amitchandak
Super User
Super User

@Anonymous ,

Try something like this

sumx(summzarize(Table, Table[month], Table[day], Table[Hour], "_1", distinctcount(Table[Ops])),[_1])

 

Change as per need. I did not check the file yet

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.