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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.