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.
I want to visualize the events (1=run/0=stop) of the current day by showing a stacked bar as presented in the picutre below where the width auto adjusts to the value. This is somewhat familiar to what I have seen with having both X/Y-axis categories i guess but maybe there is a work around or a different way of doing this?
I get this result in a normal stacked bar chart.
The waterfall chart is not far from what I need even if it builds in X/Y-axis but the x-axis should be continuos as above, not categorical. Also the events 1/0 should have to indicate instead of a breakdown.
Solved! Go to Solution.
Was able to find a solution with R-script.
library(ggplot2)
dataset$From<-as.POSIXct(dataset$From,format="%Y-%m-%dT%H:%M:%OS")
dataset$To<-as.POSIXct(dataset$To,format="%Y-%m-%dT%H:%M:%OS")
ggplot(dataset, aes(From,Room,colour=Person))+
geom_segment(aes(x=From,xend=To,yend=dataset$Room),size=10)+
ggtitle("START/STOP")
HI @lukasjar ,
What I did was the following:
[TimeStampStart] + #duration(0,0,[Hours]*60,0)
OnOFF =
IF (
MAX ( Hours[Half hour] )
<= MAXX ( ALLSELECTED ( 'Table'[ENDTIME] ), 'Table'[ENDTIME] ),
MAXX (
TOPN (
1,
FILTER ( 'Table', 'Table'[TimeStampStart] <= MIN ( Hours[Half hour] ) ),
'Table'[TimeStampStart]
),
'Table'[Event]
)
)
Check PBIX file attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsWas able to find a solution with R-script.
library(ggplot2)
dataset$From<-as.POSIXct(dataset$From,format="%Y-%m-%dT%H:%M:%OS")
dataset$To<-as.POSIXct(dataset$To,format="%Y-%m-%dT%H:%M:%OS")
ggplot(dataset, aes(From,Room,colour=Person))+
geom_segment(aes(x=From,xend=To,yend=dataset$Room),size=10)+
ggtitle("START/STOP")
Hello!
Sorry but the matrix is static and the column width does not adjust to the value.
Hi @lukasjar ,
No problem, I made the matrix to have 30 minutes intervals so the bars would correspond to the half hour periods and when you add adjacent periods it would be a bigger bar. and the making some more adjustements with conditional formatting you could show and hide other values.
But understand that your requirements may change with a full dataset glad you were abble to figure it out.
By the way I have no knowledge of R 😁.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsUsing R-script I have been able to plot the events as shown in the picture below. The issue I have now is to have different colours depending on the value of category "Person".
Any suggestions on what to change to get different colors?
library(ggplot2)
dataset$From<-as.POSIXct(dataset$From,format="%Y-%m-%dT%H:%M:%OS")
dataset$To<-as.POSIXct(dataset$To,format="%Y-%m-%dT%H:%M:%OS")
ggplot(dataset, aes(From,Room,Person))+
geom_segment(aes(x=From,xend=To,yend=dataset$Room),size=10)+
scale_colour_discrete(guide=guide_legend(override.aes=list(size=10)))+
ggtitle("START/STOP")
Timestamps (from/to) are formated as datetime and room/person is formated as text.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |