Forum Discussion
Use SWITCH with TIME() / time frames.
- 7 years ago
Hi RemiAnthonise ,
The question is about the data although you see the hours only the data behind is date so you need to get onlythe time part of Patient[Gepland ontslagtijd aangepast] column, redo your calculation to:
Tijdsblok ontslag = VAR Hour_Part = TIME ( HOUR ( Patient[Gepland ontslagtijd aangepast] ); MINUTE ( Patient[Gepland ontslagtijd aangepast] ); SECOND ( Patient[Gepland ontslagtijd aangepast] ) ) RETURN SWITCH ( TRUE (); Hour_Part > TIME ( 07; 00; 00 ) && Hour_Part < TIME ( 15; 00; 00 ); TIME ( 15; 00; 00 ); Hour_Part > TIME ( 15; 00; 00 ) && Hour_Part < TIME ( 23; 00; 00 ); TIME ( 23; 00; 00 ); TIME ( 07; 00; 00 ) )Gives the result below:
I'm not addin the PBIX since it tell me it was done on a previous version so if I send it out to you it will not open.
Regards,
MFelix
Hi RemiAnthonise ,
Is it possible to share a sample file?
As I refer based on my tests everything should match.
Regards,
MFelix
Hi RemiAnthonise ,
The question is about the data although you see the hours only the data behind is date so you need to get onlythe time part of Patient[Gepland ontslagtijd aangepast] column, redo your calculation to:
Tijdsblok ontslag =
VAR Hour_Part =
TIME ( HOUR ( Patient[Gepland ontslagtijd aangepast] ); MINUTE ( Patient[Gepland ontslagtijd aangepast] ); SECOND ( Patient[Gepland ontslagtijd aangepast] ) )
RETURN
SWITCH (
TRUE ();
Hour_Part > TIME ( 07; 00; 00 )
&& Hour_Part < TIME ( 15; 00; 00 ); TIME ( 15; 00; 00 );
Hour_Part > TIME ( 15; 00; 00 )
&& Hour_Part < TIME ( 23; 00; 00 ); TIME ( 23; 00; 00 );
TIME ( 07; 00; 00 )
)
Gives the result below:
I'm not addin the PBIX since it tell me it was done on a previous version so if I send it out to you it will not open.
Regards,
MFelix
- RemiAnthonise7 years agoHelper V
Thanks a lot for your help, MFelix .