Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)

I am using a dataset in PowerBI with many columns and has information on the incident tickets.

I am getting an error data for time format and I wrote an R Function which returns time

calculateHours <- function(hours) {
  x <- trunc(hours/24)
  rest <- mod(hours,24)
  y <- trunc(rest/10)
  z <- mod(rest,10)
  result <- (((x+y)*10)+z)
  return(result)
}

How can i solve this 

1 Answer

0 votes
by (22.5k points)
edited by

Follow the code below and link:

# 'dataset' holds the input data for this script

myfunction <- function(x) 
{
    return (x + 1)
}

dataset$NewNumber <- myfunction(dataset$Number) ## apply function and add result as new column
output <- dataset ## PowerBI uses "output" as result from this query step

If you want to learn more about Power BI, then read Power BI Tutorial. Also, enroll in Power BI Training to become proficient in this BI tool.  

Related questions

0 votes
1 answer
asked Feb 28, 2021 in BI by dev_sk2311 (45k points)
0 votes
1 answer
asked Dec 28, 2020 in BI by Chris (11.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...