Forum Discussion
Soumeli
8 months agoRegular Visitor
How to manage date field with null values
Hi Team, I am very new in Power BI. I need to create a calculated column where I am comparing two date fields eg. date1<= date2. date1 has null values and it is passing the condition. What is the...
- 8 months ago
This is one of those gotcha moments. DAX still evaluates the comparison to resolve the return type, and you end up seeing FALSE instead of BLANK(). A more fool proof way to do the comparison is by creating a custom column in the query editor.
if [Date1] = null then null else [Date1] < [Date2]Vs has this formula and we should expect for it to return blank if Custom is blank but alas it won't once the data type is changed to true/false
Kedar_Pande
8 months agoSuper User
Calculated column:
Flag =
IF (
NOT ISBLANK ( 'Table'[date1] )
&& 'Table'[date1] <= 'Table'[date2],
1,
0
)
If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande