PL-300 · Question #104
You have a CSV file that contains user complaints. The file contains a column named Logged. Logged contains the date and time each compliant occurred. The data in Logged is in the following format: 20
The correct answer is C. Create a column by example that starts with 2018-12-31 and set the data type of the new column. The Logged column contains values like '2018-12-31 at 08:59', which Power BI cannot automatically parse as a date because of the non-standard ' at ' separator. Simply changing the data type (choice A) will fail because the raw string is not a recognizable date format. Extracting
Question
You have a CSV file that contains user complaints. The file contains a column named Logged. Logged contains the date and time each compliant 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
- AChange the data type of the Logged column to Date.
- BApply a transform to extract the last 11 characters of the Logged column and set the data type of
- CCreate a column by example that starts with 2018-12-31 and set the data type of the new column
- DApply a transform to extract the first 11 characters of the Logged column.
How the community answered
(56 responses)- A11% (6)
- B5% (3)
- C80% (45)
- D4% (2)
Explanation
The Logged column contains values like '2018-12-31 at 08:59', which Power BI cannot automatically parse as a date because of the non-standard ' at ' separator. Simply changing the data type (choice A) will fail because the raw string is not a recognizable date format. Extracting the last 11 characters (choice B) would yield ' at 08:59'-the time portion, not the date. Extracting the first 11 characters (choice D) yields '2018-12-31 ' with a trailing space, which still requires trimming and a type conversion step. The cleanest approach (choice C) is to use Power Query's 'Column from Example' feature, providing '2018-12-31' as the example so Power BI intelligently infers the extraction pattern for the date portion, then set that new column's data type to Date to activate the built-in date hierarchy (Year, Quarter, Month, Day).
Topics
Community Discussion
No community discussion yet for this question.