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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Alexandergikalo
Frequent Visitor

Dynamical summarizecolumns or subquery

Hi. 
I have table like this:
DateTime,          Cabinet_id, Employee_id
01.01.20 11:00   10               25
01.01.20 11:00   10               12
01.01.20 11:05   10               25
01.01.20 11:05   10               56
01.01.20 11:10   10               null
01.01.20 11:00   12               11
01.01.20 11:05   12               null
01.01.20 11:10   12               12
How can i get bar with result of sql query:
"select hour(DateTime), count(*) from
( select DateTime,Cabinet_id group by DateTime,Cabinet_id)"?

Summarizecolumns and same dax return all the table, but i need to get result after crossfiltering by other elements.

Thank you!

1 ACCEPTED SOLUTION

Hi @Alexandergikalo ,

 

Create the calculated column:

HOUR('Table (2)'[DateTime])

 

And this measure:

 

Measure 2 =
COUNTX(SUMMARIZE('Table (2)'; 'Table (2)'[DateTime]; 'Table (2)'[Cabinet_id]; 'Table (2)'[Hour]); 'Table (2)'[Hour])
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Alexandergikalo 

Take out Hour part in a new column

Hour = Hour([DateTime])

Or

Hour = Format([DateTime],"HH")

The plot any visual take cabinate_id on row/group and take the sum of hours and use it

measure =count(Table[Hours])

Or

 

measure =Countx(Summarize(Table,Table[Cabinet_id],Table[DateTime],Table[Hour]),[Hour])

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
camargos88
Community Champion
Community Champion

Hi @Alexandergikalo ,

Try creating a calculated column:

 

Hour = HOUR('Table'[DateTime])
 
After that:
 
Capture.PNG
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Not that case( 
Sql query will return this tesult
01.01.20 11:00   6 recors
Your count - 8 
I neet to exlude some kind of doubles.

Hi @Alexandergikalo ,

 

Create the calculated column:

HOUR('Table (2)'[DateTime])

 

And this measure:

 

Measure 2 =
COUNTX(SUMMARIZE('Table (2)'; 'Table (2)'[DateTime]; 'Table (2)'[Cabinet_id]; 'Table (2)'[Hour]); 'Table (2)'[Hour])
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Thanks) I got a solution.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.