The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi
I have a table A0 that has the following structure and sample values:
Date | Time | Username |
3/11/2022 | 7:19:16 AM | abc |
3/13/2022 | 11:20:56 PM | xyx |
3/13/2022 | 12:25:44 PM | fff |
I want to create a trend graph as follows:
Solved! Go to Solution.
Hi @deedeedudu ,
You can try the following methods.
Column:
Time Interval =
IF ( HOUR ( [Time] ) >= 12, HOUR ( [Time] ) - 12, HOUR ( [Time] ) ) & "-"
& IF ( HOUR ( [Time] ) >= 12, HOUR ( [Time] ) - 12 + 1, HOUR ( [Time] ) + 1 )
& IF ( HOUR ( [Time] ) >= 12, "PM", "AM" )
Username (#) =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[Time Interval] = EARLIER ( 'Table'[Time Interval] ) )
)
Index is only used for sorting.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your sample data doesn't match the output. Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
Hi @lbendlin
The data would look like following:
DateTimeUsername
3/11/22 | 1:01:00 AM | a1 |
3/11/22 | 2:10:00 AM | a2 |
3/11/22 | 2:34:00 AM | a3 |
3/11/22 | 3:10:00 AM | a4 |
3/11/22 | 3:10:00 AM | a5 |
3/11/22 | 3:10:00 AM | a6 |
3/11/22 | 4:10:00 AM | a7 |
3/11/22 | 4:10:00 AM | a8 |
3/11/22 | 4:11:00 AM | a8 |
3/11/22 | 4:12:00 AM | a8 |
3/11/22 | 5:10:00 AM | a11 |
3/11/22 | 5:10:00 AM | a12 |
3/11/22 | 5:10:00 AM | a13 |
3/11/22 | 5:10:00 AM | a14 |
3/11/22 | 5:10:00 AM | a15 |
3/11/22 | 6:10:00 AM | a16 |
3/11/22 | 6:10:00 AM | a17 |
3/11/22 | 6:10:00 AM | a18 |
3/11/22 | 6:10:00 AM | a19 |
3/11/22 | 6:10:00 AM | a20 |
3/11/22 | 6:10:00 AM | a21 |
3/11/22 | 7:10:00 AM | a22 |
3/11/22 | 7:10:00 AM | a23 |
3/11/22 | 7:10:00 AM | a24 |
3/11/22 | 7:10:00 AM | a25 |
3/11/22 | 7:10:00 AM | a26 |
3/11/22 | 7:10:00 AM | a27 |
3/11/22 | 7:10:00 AM | a28 |
3/11/22 | 8:10:00 AM | a29 |
3/11/22 | 8:10:00 AM | a30 |
3/11/22 | 8:10:00 AM | a31 |
3/11/22 | 8:10:00 AM | a32 |
3/11/22 | 8:10:00 AM | a33 |
3/11/22 | 8:10:00 AM | a34 |
3/11/22 | 8:10:00 AM | a35 |
3/11/22 | 8:10:00 AM | a36 |
3/11/22 | 9:10:00 AM | a37 |
3/11/22 | 9:10:00 AM | a38 |
3/11/22 | 9:10:00 AM | a39 |
3/11/22 | 9:10:00 AM | a40 |
3/11/22 | 9:10:00 AM | a41 |
3/11/22 | 9:10:00 AM | a42 |
3/11/22 | 9:10:00 AM | a43 |
3/11/22 | 9:10:00 AM | a44 |
3/11/22 | 9:10:00 AM | a45 |
3/11/22 | 10:10:00 AM | a46 |
3/11/22 | 10:10:00 AM | a47 |
3/11/22 | 10:10:00 AM | a48 |
3/11/22 | 10:10:00 AM | a49 |
3/11/22 | 10:10:00 AM | a50 |
3/11/22 | 10:10:00 AM | a51 |
3/11/22 | 10:10:00 AM | a52 |
3/11/22 | 10:10:00 AM | a52 |
The graph should be generated based on the following data that is to be derived from the above table by aggregating the users for 1 hr interval:
Date | Time Interval | Username (#) |
3/11/22 | 0-1AM | 0 |
3/11/22 | 1-2AM | 1 |
3/11/22 | 2-3AM | 2 |
3/11/22 | 3-4AM | 3 |
3/11/22 | 4-5AM | 4 |
3/11/22 | 5-6AM | 5 |
3/11/22 | 6-7AM | 6 |
3/11/22 | 7-8AM | 7 |
3/11/22 | 8-9AM | 8 |
3/11/22 | 9-10AM | 9 |
3/11/22 | 10-11AM | 8 |
3/11/22 | 11-12AM | 7 |
3/11/22 | 12-1PM | 8 |
3/11/22 | 1-2PM | 9 |
3/11/22 | 2-3PM | 10 |
3/11/22 | 3-4PM | 11 |
3/11/22 | 4-5PM | 12 |
3/11/22 | 5-6PM | 13 |
3/11/22 | 6-7PM | 14 |
3/11/22 | 7-8PM | 15 |
3/11/22 | 8-9PM | 16 |
3/11/22 | 9-10PM | 17 |
3/11/22 | 10-11PM | 18 |
3/11/22 | 11-12PM | 19 |
3/12/22 | 12-1AM | 20 |
3/12/22 | 1-2AM | 19 |
3/12/22 | 2-3AM | 18 |
3/12/22 | 3-4AM | 17 |
3/12/22 | 4-5AM | 16 |
3/12/22 | 5-6AM | 15 |
3/12/22 | 6-7AM | 14 |
3/12/22 | 7-8AM | 13 |
3/12/22 | 8-9AM | 12 |
3/12/22 | 9-10AM | 11 |
3/12/22 | 10-11AM | 12 |
3/12/22 | 11-12AM | 13 |
Hi @deedeedudu ,
You can try the following methods.
Column:
Time Interval =
IF ( HOUR ( [Time] ) >= 12, HOUR ( [Time] ) - 12, HOUR ( [Time] ) ) & "-"
& IF ( HOUR ( [Time] ) >= 12, HOUR ( [Time] ) - 12 + 1, HOUR ( [Time] ) + 1 )
& IF ( HOUR ( [Time] ) >= 12, "PM", "AM" )
Username (#) =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[Time Interval] = EARLIER ( 'Table'[Time Interval] ) )
)
Index is only used for sorting.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your data is good as is. Add a calculated column
Time Interval = hour([Time])
and put everything in a table.
I didn't follow your formatting because it is ambiguous, especially the "11-12AM" part 🙂 . If you want you can add that yourself.