I'm using PowerBI to build a calculated table to do time calculation on an existing table.
calc_issues = CALCULATETABLE(
SELECTCOLUMNS('public issues', "created_at_dt", 'public issues'[created_at], "closed_at_dt", 'public issues'[closed_at]))
Both these columns are text in my original database and are imported as text in this calculated table. When I try to switch this calculated table into a Date/Time I get the following issue:
Cannot convert value '2021-09-09T14:55:11Z' of type Text to type Date while processing column.
Now if I go into my database table and convert the text into Date/Time there's error. But I want this new calculated table to show specific Date/Time calculations.
When I try to create a new column and try to do a DATEVALUE on the text I get the same error.
Solution: Power Editor doesn't modify the existing database table when using direct.
The query editor can be used to convert the text into time stamps. I loaded your data sample into Power Query in a blank query and it was converted automatically, even converting Zulu to my local time.
If you don't want to convert to local time, then remove the Z from the text by extracting the first 19 characters of the text, then change the data type.
Related
hope you're doing well.
I'm a newbie to PowerBI and I'd want to convert the decimal time/date column values into hours of the time to plot the info over a 24-hour timeline. I was able to achieve this in tableau and as it automatically detects the hours and can easily be able to plot the info. I was a bit close in achieving this in powerBI as I converted the date/time column to time and tried plotting but there's huge noise and looks more cluttered as it took every change in seconds/minutes (the bottom snippet). I've attached the snippets for reference, can anyone pls try to help me on this ?
In Power BI it's recommended to split the DateTime column into separate Date and Time columns. This is both for performance reasons. Over a year a DateTime column with 1sec granularity can have 30M different values, which is much more data than storing one column with 365 values, and one with 86,400 values. And so that your Date column can link to a Date Dimension to provide other DateTime hierarchy attributes, like FiscalQuarter, DayOfWeek, etc.
In Power Query select the DateTime column and go to --> Add Column --> Time -- > Time Only. Then change the data type of the DateTime column to Date.
This also solves your reporting problem as you can simply put the Time column on the X axis.
If you want a custom format string for the time you can add a calculated column in Power Query like
= Table.AddColumn(#"Changed Type1", "TimeDesc", each DateTime.ToText(#date(2020,1,1)&[Time], [Format="h tt"]))
And configure the new column with a "Sort by Column" of Time.
I have a set of data ~36 000 rows from which in one column there are numbers and numbers with text (100567563; WT1632366; 3275-2422 etc.) I need it to show the data as it is. It's not an error and I have tried changing what the data is (text numbers general in excel and in Power bi with no success. Any tips?
In power bi ensure that you have the datatype of that column as text, It works absolutely fine for me.
Power Query previews the dataset, and determines the datatype from the first 1000 rows. From your question I'm going to assume that the first lot of previewed rows are numerical.
You can order your Excel file to have the first rows as 'WT1632366' then when it loads the data it will convert it to the text/string type, and load the numerical columns as text.
If you look in the query editor, you will see a 'changed type', you can see the column name and the format. In the below image I have a column called 'Data' you can change it from:
"Data", Int64.Type
to
"Data", type text
And it should load.
Note: If you insert a step after it that does this, it may still not load and error
In the image, the first 1200 rows are the number 1, the 1201 row is the text 'ABC' this will fail on load unless you change formating to text. You can do this by clicking on the column and clicking on the '123' and change it from the selection to text. If it asked to replace current step use that option.
Once the datatypes are set it will not reavelate them on later loads, so you don't have to worry about data type changes
This is sample of values appearing in my time custom column:
Part of formula that generated this custom column goes like this:
RETURN FORMAT( TIME(hr; mn;ss); "HH:mm:ss" ))
so this column suppose to be in "time" format.
But in visuals this column is recognized as text with discrete values. Is there a way to define it as time and use it as slicer/filter which is time based?
In the modeling tab, make sure the data type for your calculated column is set to 'Time'.
I am getting data from an excel file which include a column which shows duration as mm:ss:ms
But when I import the data to Power BI Desktop with Power Query, it converts this column to date/time format.
I don't know how can I solve this issue.
Any idea?
I already tried the code below:
format(((TableName[Duration] / 60)/60)/24, "HH:mm:ss")
and already tried to change the source column type from the excel to general.
PowerBI does not currently support milliseconds in date time datatype. You can convert the excel doc to general, load it into PowerBI, and multiply the value by 86400 to get the total number of seconds. Otherwise you'll need to bring it in as a string and do string manipulations to pull out the information you want.
Hope it helps.
I'm getting this error message:
Datetime column not provided as part table configuration and is required by this type of chart
I'd like to create a chart showing change in total volume over time. I have a date field created as a column that I'd like to use as a datetime but cannot figure out how.
Data is an uploaded .csv file.
How do you change a column to datetime in table configuration?
How do you change a column to datetime in table configuration?
You should be fine casting that column to a timestamp instead.
Superset complains about a missing datetime column because it's written in Python; but assuming you're querying a postgres DB, the equivalent type would be timestamp.
If your datasource is based off a query; you should be able to cast the date type to timestamp (use ::timestamp or to_timestamp()) and use that as your "datetime" column.
In process of uploading the CSV file, we should set up names of columns with dates:
check if you have date or time series in your data once you make sure of that,if the format of the date just year, then the DATETIME format is this '%Y'.
if the format is yyyy/mm/dd then the DATATIME format is "%Y/%m/%d" and for the rest of the formats check here
all these formats had to be edited in the edit dataset window in supersetclick here for image
go with the documentation it helps a lot.
Define in CSV to Database configuration before uploading: