Symptom
In Datasphere Graphical View, even after adding a calculated column with expression CASE WHEN THEN END to replace NULL with empty, some Date attributes' values are still displayed as NULL instead of empty.
Environment
SAP Datasphere
Reproducing the Issue
- In the Datasphere Graphical view, create a calculated column.
- Enter a Business Name and a Technical Name for the column, for example, name the technical name as 'Last posting Date'.
- Specify its Data Type as 'Date'.
- Enter following SQL expression into the Expression field.
CASE
WHEN "Last posting Date" IS NULL THEN ''
ELSE "Last posting Date"
END - Click 'Data Viewer' to preview the data.
- Confirm the NULL values are still displayed.
Cause
As the data type of column 'Last posting Date' is Date, the SQL of ELSE "Last posting Date" cannot be handled correctly, causing the SQL not working properly.
Resolution
To replace NULL values in the column "Last posting Date" with an empty value correctly, Use LTRIM Function (String) to return the string value of the Date column in ELSE.
In this example, use following expression instead:
CASE
WHEN "Last posting Date" IS NULL THEN ''
ELSE LTRIM("Last posting Date")
END
Alternatively, it is also possible to use IFNULL Function (Miscellaneous) with following expression to replace NULL with epmty values:
IFNULL(LTRIM("Last posting Date"),'')
See Also
See more details in following Portal Help guides:
Create a Calculated Column in a Graphical View
Keywords
datasphere, date field, null, blank, empty, no value, calculated column, fact view, case expression, ifnull, ltrim, replace null, data builder, display blank , KBA , DS-MD-VIW , Views , Problem
SAP Knowledge Base Article - Public