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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Popica
Frequent Visitor

PowerBi Visual / Data, time aggregation

Hello. 

I am at a loss on how to achieve the following agregation of units (by time):

 

Popica_0-1693244420915.png

Incidents are stored as unique entries, each with its own timestamp (date and time).

Grouping is a duration metric and Aggregation is Count. 

Any directions ?

1 ACCEPTED SOLUTION
Popica
Frequent Visitor

I was able to figure it out. Dax column with the following conditions:

 

Duration labels =
//Same Day
IF([Duration Seconds] <= 86400, "Same Day",
// 2 Days
IF ([Duration Seconds] > 86400 && [Duration Seconds] <= 172800, "2 Days",
// 2 - 5 Days
IF ([Duration Seconds] > 172800 && [Duration Seconds] <= 432000, "2 - 5 Days",
// 5 - 7 Days
IF ([Duration Seconds] > 432000 && [Duration Seconds] <= 604800, "5 - 7 Days",
// 1 - 2 Weeks
IF ([Duration Seconds] > 604800 && [Duration Seconds] <= 1.21e+6, "1 - 2 Weeks",
// 2 - 4 Weeks
IF ([Duration Seconds] > 1.21e+6 && [Duration Seconds] <= 2.419e+6, "2 - 4 Weeks",
// 1 - 2 Months
IF ([Duration Seconds] > 2.419e+6 && [Duration Seconds] <= 4.838e+6, "1 - 2 Months",
// > 2 Months
IF ([Duration Seconds] > 4.838e+6, "> 2 Months", "Not Measured"))))))))

 

Baiscally it asigns a text value to a number (and/or range).

Output is as desired:

Popica_0-1693257992611.png

 



 

View solution in original post

3 REPLIES 3
Popica
Frequent Visitor

I was able to figure it out. Dax column with the following conditions:

 

Duration labels =
//Same Day
IF([Duration Seconds] <= 86400, "Same Day",
// 2 Days
IF ([Duration Seconds] > 86400 && [Duration Seconds] <= 172800, "2 Days",
// 2 - 5 Days
IF ([Duration Seconds] > 172800 && [Duration Seconds] <= 432000, "2 - 5 Days",
// 5 - 7 Days
IF ([Duration Seconds] > 432000 && [Duration Seconds] <= 604800, "5 - 7 Days",
// 1 - 2 Weeks
IF ([Duration Seconds] > 604800 && [Duration Seconds] <= 1.21e+6, "1 - 2 Weeks",
// 2 - 4 Weeks
IF ([Duration Seconds] > 1.21e+6 && [Duration Seconds] <= 2.419e+6, "2 - 4 Weeks",
// 1 - 2 Months
IF ([Duration Seconds] > 2.419e+6 && [Duration Seconds] <= 4.838e+6, "1 - 2 Months",
// > 2 Months
IF ([Duration Seconds] > 4.838e+6, "> 2 Months", "Not Measured"))))))))

 

Baiscally it asigns a text value to a number (and/or range).

Output is as desired:

Popica_0-1693257992611.png

 



 

CharbelArmaleh
Resolver II
Resolver II

Hello, create a calculated column to group the tgimestamp and use this column + count of lines or IDs

I am looking at the "Same day" "2 Days" "2-5 Days" grouping (tgimestamp was a typo for timestamp)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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