Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Blank or Null Date Validation

I am trying to write basic if condition considering date field, there are chances of blank in date field. I am aiming to name blank fields based in if loop. Below is the condition I write but for each and every row I am getting DMT only

 

Lifecycle = IF(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]>=TODAY()-30, "30DayActive",IF(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]<TODAY()-90, "Dormant",IF(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]=BLANK(), "Never Active",IF(AND(POC_SBSPN_LIFECYC_ACTUAL[ Schd Dt]>=TODAY()-90,POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]<TODAY()-30),"Inactive", "Others"))))
 
I try both BLANK(), ISBLANK option please help.
 
Thanks - Krishna
1 ACCEPTED SOLUTION
DoubleJ
Solution Supplier
Solution Supplier

Hi

I would suggest that you use the ISBLANK() check as first condition.
Personally I prefer a SWITCH() to nested IFS(). The code could look like this:

Lifecycle = 
SWITCH(TRUE(),
ISBLANK(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]),"Never Active",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]>=TODAY()-30,"30DayActive",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]>=TODAY()-90 && POC_SBSPN_LIFECYC_ACTUAL[Schd Dt] < TODAY()-30, "Inactive",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]<TODAY()-90,"Dormant",
"Other")

 

Hope this helps!
JJ

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

ISBLANK(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt])  should have work.  Can you share a sample file.

DoubleJ
Solution Supplier
Solution Supplier

Hi

I would suggest that you use the ISBLANK() check as first condition.
Personally I prefer a SWITCH() to nested IFS(). The code could look like this:

Lifecycle = 
SWITCH(TRUE(),
ISBLANK(POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]),"Never Active",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]>=TODAY()-30,"30DayActive",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]>=TODAY()-90 && POC_SBSPN_LIFECYC_ACTUAL[Schd Dt] < TODAY()-30, "Inactive",
POC_SBSPN_LIFECYC_ACTUAL[Schd Dt]<TODAY()-90,"Dormant",
"Other")

 

Hope this helps!
JJ

Anonymous
Not applicable

Yes, finally SWITCH is working well. I tested with other conditions as well. 

 

On the other I created a new column to test Isblank having only isblank condition and that is also working but not with other conditions including. Not sure what makes the difference. 

 

Thanks - Krishna.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.