Forum Discussion
IF statement maybe?
Hi all
I have a problem wondering if anyone could make any suggestions or help??Â
I have the following calcuated column:
FirstDayEndTime =
DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) )
& " 17:00:00"
the problem i have is that different customers have different end times, could i do a IF statement on a customer name to generate a different end time specific to individual customers? or any other suggestions??
Hi tmears
From my point of view ...
if you know and can assign to each customer a range hour.
Let's say all the customers that end their hours at 17:00 could be assigned 'Type A', and all those that end their hours at 18:00 could be assigned 'Type B'
Then you could use ....
FirstDayEndTime =
IF(
Customers[Type] = "Type A",
DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) )
& " 17:00:00",
DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) )
& " 18:00:00"
)
Hope That Helps
VicenteHi tmears,
In addition, using SWITCH function should also work. :smileyhappy:
FirstDayEndTime = SWITCH ( Customers[Type], "Type A", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 17:00:00", "Type B", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 18:00:00", "Type C", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 19:00:00", "Type D", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 20:00:00" )Regards
9 Replies
- Greg_DecklerCommunity Champion
If you created that as a measure, you could put it into a table along with customer name and it should give you what you want. That being said, not sure what you want as there is not a lot of context here.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- tmearsHelper III
thanks for the reply, sorry you are right not alot of detail:
i have followed the enlcosed post:
basically i am trying to calcualte the amount of time a service request or case is open for in dynamics. the above posts works brilliantly however the issue i have is that swome customer have different support hours. following the post the support hours is 9:00 to 17:00 but some specfic customer have different hours for example 8:00 to 18:00 so the time calcuations on these customer are wrong. Not sure if possible and have been trying to wrap my brians that if the case relates to customer A the oprnbing hours are changed
- v-ljerr-msftMicrosoft Employee
Hi tmears,
In addition, using SWITCH function should also work. :smileyhappy:
FirstDayEndTime = SWITCH ( Customers[Type], "Type A", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 17:00:00", "Type B", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 18:00:00", "Type C", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 19:00:00", "Type D", DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) ) & " 20:00:00" )Regards
- vcastelloResolver III
Hi tmears
From my point of view ...
if you know and can assign to each customer a range hour.
Let's say all the customers that end their hours at 17:00 could be assigned 'Type A', and all those that end their hours at 18:00 could be assigned 'Type B'
Then you could use ....
FirstDayEndTime =
IF(
Customers[Type] = "Type A",
DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) )
& " 17:00:00",
DATE ( YEAR ( incident[createdon] ), MONTH ( incident[createdon] ), DAY ( incident[createdon] ) )
& " 18:00:00"
)
Hope That Helps
Vicente