PL-300 · Question #358
You have a CSV file that contains user complaints. The file contains a column named Logged. Logged contains the date and time each complaint occurred. The data in Logged is in the following format: 20
The correct answer is C. Split the Logged column by using at as the delimiter.. To enable date hierarchy analysis, the Logged column's non-standard format requires splitting by the 'at' delimiter to isolate the date part before setting its data type.
Question
You have a CSV file that contains user complaints. The file contains a column named Logged. Logged contains the date and time each complaint occurred. The data in Logged is in the following format: 2018-12-31 at 08:59. You need to be able to analyze the complaints by the logged date and use a built-in date hierarchy. What should you do?
Options
- AApply the Parse function from the Data transformations options to the Logged column.
- BChange the data type of the Logged column to Date.
- CSplit the Logged column by using at as the delimiter.
- DCreate a column by example that starts with 2018-12-31.
How the community answered
(22 responses)- A9% (2)
- B5% (1)
- C68% (15)
- D18% (4)
Why each option
To enable date hierarchy analysis, the `Logged` column's non-standard format requires splitting by the 'at' delimiter to isolate the date part before setting its data type.
While a 'Parse' function might exist in some contexts, there isn't a direct 'Parse' function under 'Data transformations' in Power Query Editor that would automatically handle this specific non-standard format by itself to create a date hierarchy.
Simply changing the data type to Date would result in errors or null values for rows with the 'at' string, as Power BI cannot parse the original string directly into a date format.
The 'Logged' column contains 'at' which prevents Power BI from directly recognizing it as a date/time. Splitting the column by 'at' as a delimiter will separate the date part (e.g., '2018-12-31') from the time part, allowing the extracted date component to then be correctly recognized as a Date data type, thereby enabling the built-in date hierarchy.
Creating a column by example starting with '2018-12-31' would extract the date part but requires manual input and might not be robust for varied dates, and it's an indirect way to achieve the goal compared to a direct transformation for the entire column.
Concept tested: Cleaning and transforming non-standard date strings for date hierarchy
Source: https://learn.microsoft.com/en-us/power-query/split-column-by-delimiter
Community Discussion
No community discussion yet for this question.