Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I have created a calculated column to show if certain end time (format 09:20) is false between certain ranges.
DAX used
Solved! Go to Solution.
I assumed your end time column was a Time column, but is it a DateTime? If so, you'll have to get the time component from it like this. You should consider splitting DateTime columns if not already.
7AM-10am =
VAR vTime =
TIME ( HOUR ( dilo_master[end_time] ), MINUTE ( dilo_master[end_time] ), SECOND ( dilo_master[end_time] ) )
RETURN
IF (
vTime >= TIME ( 7, 0, 0 )
&& vTime <= TIME ( 10, 0, 0 ),
TRUE (),
FALSE ()
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this instead
7AM-10am = IF(dilo_master[end_time] >= TIME(7,0,0) && dilo_master[end_time] <= TIME(10,0,0) ,TRUE(),FALSE())
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
This has returned FALSE for every row. I have tried changing my end time column format between long and short time but this has not changed the output.
Thanks,
Elliot
I assumed your end time column was a Time column, but is it a DateTime? If so, you'll have to get the time component from it like this. You should consider splitting DateTime columns if not already.
7AM-10am =
VAR vTime =
TIME ( HOUR ( dilo_master[end_time] ), MINUTE ( dilo_master[end_time] ), SECOND ( dilo_master[end_time] ) )
RETURN
IF (
vTime >= TIME ( 7, 0, 0 )
&& vTime <= TIME ( 10, 0, 0 ),
TRUE (),
FALSE ()
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thats perfect. Thank you!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
117 | |
101 | |
71 | |
61 |