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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
TejasShah
Helper I
Helper I

How to get customized Bar graph with 6am to 6am filter

After going through a lot of posts, I was unable to find any way out for my issue.

I have a table with values and timestamp of multiple rows for single hour:

IdValuetimestamp
310.8810-04-2024 15:00:59
41.7210-04-2024 15:00:42
522.5710-04-2024 15:00:29
4010-04-2024 15:00:03
30.0410-04-2024 14:00:45
510.9110-04-2024 14:00:19
313.6810-04-2024 13:00:50
45.6610-04-2024 13:00:28
53.6310-04-2024 13:00:11
42.5210-04-2024 12:00:40
51.1410-04-2024 12:00:07
347.110-04-2024 11:00:56
40.1210-04-2024 11:00:39
31.5910-04-2024 11:00:20
5010-04-2024 11:00:07
40.9210-04-2024 10:00:55
5142.9410-04-2024 10:00:17
46.1610-04-2024 09:00:12
52.3110-04-2024 08:00:36
30.8310-04-2024 08:00:13
5010-04-2024 07:00:54
36.5810-04-2024 06:00:25
41.3910-04-2024 05:00:54
30.3510-04-2024 05:00:43
30.9410-04-2024 04:00:29
563.510-04-2024 04:00:10
5010-04-2024 03:00:52
352.1310-04-2024 02:00:49
48.3410-04-2024 01:00:57
49.1310-04-2024 01:00:46
5010-04-2024 00:00:51
32.6109-04-2024 23:00:23
54.0909-04-2024 22:00:51
57.1509-04-2024 22:00:32
4009-04-2024 22:00:14
31.9809-04-2024 20:00:55
430.2809-04-2024 20:00:42
40.1609-04-2024 20:00:20
537.8409-04-2024 20:00:18
43.7509-04-2024 20:00:05

 

I have converted these timestamp data to timestamp (bins) where I have kept 1 hour data as 1 bin.

 

TejasShah_2-1713093066104.png

 

timestamp (bins)
10-04-2024 15:00
10-04-2024 15:00
10-04-2024 15:00
10-04-2024 15:00
10-04-2024 14:00
10-04-2024 14:00
10-04-2024 13:00
10-04-2024 13:00
10-04-2024 13:00
10-04-2024 12:00
10-04-2024 12:00
10-04-2024 11:00
10-04-2024 11:00
10-04-2024 11:00
10-04-2024 11:00
10-04-2024 10:00
10-04-2024 10:00
10-04-2024 09:00
10-04-2024 08:00
10-04-2024 08:00
10-04-2024 07:00
10-04-2024 06:00
10-04-2024 05:00
10-04-2024 05:00
10-04-2024 04:00
10-04-2024 04:00
10-04-2024 03:00
10-04-2024 02:00
10-04-2024 01:00
10-04-2024 01:00
10-04-2024 00:00
09-04-2024 23:00
09-04-2024 22:00
09-04-2024 22:00
09-04-2024 22:00
09-04-2024 20:00
09-04-2024 20:00
09-04-2024 20:00
09-04-2024 20:00
09-04-2024 20:00

 

I also have the Flag6to6 where in I get data only from 6am current day to 6am of next day. Using timestamp (bins) and these Flag6to6 measure, I am able to get a bar graph where I have daily data plot as per timestamp (bins) from 6am of 9th to 5am of 10th.

TejasShah_0-1713092635270.png

 

What I need is:

1. How to club these bars with date heirarchy. I can get month/day heirarchy in timestamp but not in timestamp (bins)

TejasShah_1-1713092879612.png

 

2. Is it possible to get one single bar with sum of values from 6am 9th to 5am of 10th ?

 

Please support, thank you.

2 ACCEPTED SOLUTIONS
v-zhouwen-msft
Community Support
Community Support

Hi @TejasShah ,

Regarding your question, here is my understanding.

1.How to club these bars with date heirarchy. 

After my attempts, it's true that you can't view the date hierarchy after grouping, you might want to try another method.

Create a date calculation column using the following dax expression.

 

Column = DATE(YEAR([timestamp]),MONTH([timestamp]),DAY([timestamp])) + TIME(HOUR([timestamp]),MINUTE([timestamp]),00)

 

vzhouwenmsft_1-1713146519421.png

2.Is it possible to get one single bar with sum of values from 6am 9th to 5am of 10th ?

Create a date calculation column using the following dax expression.

 

Column 2 = SWITCH(TRUE(),
[Column]  >= DATE(2024,4,9) + TIME(6,00,00) && [Column] <=DATE(2024,4,10) + TIME(5,00,00)," 6am 9th to 5am of 10th",
"Other")

vzhouwenmsft_0-1713147553511.png

 

 

vzhouwenmsft_2-1713147167431.png


Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @TejasShah ,

Regarding your question, the data are as follows.

vzhouwenmsft_0-1713257834697.png

Use the following DAX expression to create a column

Range = IF(HOUR([Date]) >=6,DATE(YEAR([Date]),MONTH([Date]),DAY([Date])),DATE(YEAR([Date]),MONTH([Date]),DAY([Date])) - 1 )

vzhouwenmsft_1-1713257932604.png

Final output

vzhouwenmsft_2-1713257980010.png

vzhouwenmsft_3-1713257996267.png

vzhouwenmsft_4-1713258012970.png

vzhouwenmsft_5-1713258031188.png

vzhouwenmsft_6-1713258050985.png

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
TejasShah
Helper I
Helper I

@v-zhouwen-msft thank you so much for your support. The 1st part of the topic is prefectly solved as per your inputs and suggestion of creating an additional timestamp column using Dax.

But the only issue with the 2nd part, where-in you have used calculated Dax column for showcasing single bar graph for the single day as per my requirement. I am sorry since I didn't mention the wider scope.

The calculated Dax column could give me bar graph from 6am of 9th to 5am of 10th, but similarly I wanted to get it for all the days selected in the slicer.

For example, if I select 7th to 11th date in the slicer, can I get individual bars in the same graph with one bar for 7th to 8th (6am to 5am sum), second bar with 8th to 9th (6am to 5am sum) and so on.

 

Thank you once again for your support and help.

Hi @TejasShah ,

Regarding your question, the data are as follows.

vzhouwenmsft_0-1713257834697.png

Use the following DAX expression to create a column

Range = IF(HOUR([Date]) >=6,DATE(YEAR([Date]),MONTH([Date]),DAY([Date])),DATE(YEAR([Date]),MONTH([Date]),DAY([Date])) - 1 )

vzhouwenmsft_1-1713257932604.png

Final output

vzhouwenmsft_2-1713257980010.png

vzhouwenmsft_3-1713257996267.png

vzhouwenmsft_4-1713258012970.png

vzhouwenmsft_5-1713258031188.png

vzhouwenmsft_6-1713258050985.png

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-zhouwen-msft thank you very much, I was able to get what exactly I needed, and I also learned a lot about how can we play around with Timestamp columns as well, as per our requirements.

Thank you once again.

v-zhouwen-msft
Community Support
Community Support

Hi @TejasShah ,

Regarding your question, here is my understanding.

1.How to club these bars with date heirarchy. 

After my attempts, it's true that you can't view the date hierarchy after grouping, you might want to try another method.

Create a date calculation column using the following dax expression.

 

Column = DATE(YEAR([timestamp]),MONTH([timestamp]),DAY([timestamp])) + TIME(HOUR([timestamp]),MINUTE([timestamp]),00)

 

vzhouwenmsft_1-1713146519421.png

2.Is it possible to get one single bar with sum of values from 6am 9th to 5am of 10th ?

Create a date calculation column using the following dax expression.

 

Column 2 = SWITCH(TRUE(),
[Column]  >= DATE(2024,4,9) + TIME(6,00,00) && [Column] <=DATE(2024,4,10) + TIME(5,00,00)," 6am 9th to 5am of 10th",
"Other")

vzhouwenmsft_0-1713147553511.png

 

 

vzhouwenmsft_2-1713147167431.png


Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.