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

Aggregate data in a hourly interval

I have a direct query table with a creation date column.

 

I want to aggregate all values for one hour of certain day.

 

I can relate the values ​​read in a day through the calendar with a relationships.

2.PNG3.PNG

 

I built this type of "hourly" calendar with these relationships.

6.PNG

4.PNG5.PNG

 

 

However I cannot group the data by the hour as I do daily, i dont now why. 

 

 

1 ACCEPTED SOLUTION

Here my date table

 

Date = 
VAR MinYear = YEAR ( MIN ( ATEs[Date] ) )
VAR MaxYear = YEAR ( MAX ( ATEs[Date] ) )
RETURN
ADDCOLUMNS (
    FILTER (
        CALENDARAUTO( ); 
        AND ( YEAR ( [Date] ) >= MinYear; YEAR ( [Date] ) <= MaxYear )
    );
    "Year"; YEAR ( [Date] );
    "Month Name"; FORMAT ( [Date]; "mmmm" );
    "Month Number"; MONTH ( [Date] );
    "Weekday"; FORMAT ( [Date]; "dddd" );
    "Weekday number"; WEEKDAY( [Date] );
    "Quarter"; "Q" & TRUNC ( ( MONTH ( [Date] ) - 1 ) / 3 ) + 1;
    "Day of Month"; Day([Date])
)

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

9 REPLIES 9

Hi @Anonymous,

 

look at this.

https://community.powerbi.com/t5/Desktop/Struggling-to-get-result-I-want-from-TopN-function/m-p/854842#M410209

I separate date and time.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

That results for a table but i need to do a chart divided by month day and time on x axis... It´s possible?

Thanks

dobregon
Impactful Individual
Impactful Individual

hi,

 

The problem is your relationship between the table called "package..." and "calendar". As you see the calendar is in hourly basis but your timeseries in your main table have timeseries like 15:49:00h so, it will not match with any hour in your calendar.

One solutions that you can do is to round your timeseries to up or down (your choice) in order to have a timeseries with date and time in round hours. then you can create the relationship one to many (from calendar to your main table)

Then you can create the visual chart using in the X Axis the timeseries in the calendar table and the values what you want in the Y axis. Remember that in the round of the timeseries could be possible that some timeseries could be repetead with different values of weight so.. you cna take the max, average or whatever agregation that you have




Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Anonymous
Not applicable

@dobregon i cant round my time series because i have a directquery table

Hi @Anonymous ,

 

you mean something like this?

DateTime.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

@mwegener exactly that's what I want.

 

Which variables you put on the x axis to do the chart?

 

Thanks

Date_Month_Var.png

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

How i do to have the day of month?

Here my date table

 

Date = 
VAR MinYear = YEAR ( MIN ( ATEs[Date] ) )
VAR MaxYear = YEAR ( MAX ( ATEs[Date] ) )
RETURN
ADDCOLUMNS (
    FILTER (
        CALENDARAUTO( ); 
        AND ( YEAR ( [Date] ) >= MinYear; YEAR ( [Date] ) <= MaxYear )
    );
    "Year"; YEAR ( [Date] );
    "Month Name"; FORMAT ( [Date]; "mmmm" );
    "Month Number"; MONTH ( [Date] );
    "Weekday"; FORMAT ( [Date]; "dddd" );
    "Weekday number"; WEEKDAY( [Date] );
    "Quarter"; "Q" & TRUNC ( ( MONTH ( [Date] ) - 1 ) / 3 ) + 1;
    "Day of Month"; Day([Date])
)

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


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.