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
colem246
Frequent Visitor

Exclude Null Data from Subtraction

Hello,

 

Im subtracting two columns that both include the date. Some of the cells are empty because no dates are available for the information.. How can I exclude the null information in the measure?

 

What I have so far is:

 

FirstTime = 'Activity '[First Time]-'Activity [Activity Date]

 

The result I get for the null values is just "12:00:00AM" but I would rather not have the data show.

 

Thanks

11 REPLIES 11
Interkoubess
Solution Sage
Solution Sage

Hi @colem246,

 

 

Please try something with an if like this:

 

if(isblank( or('Activity '[First Time]), 'Activity [Activity Date])),blank(), Activity '[First Time])-'Activity [Activity Date])

Let us know if it does not work...

 

Ninter

This is still giving me 12:00am even when the 'Activity '[First Time] is blank.

 

 

hi @colem246,

 

Please give a sample data with your expected result and then I can try another approach.

 

Ninter

Here is an example of what it looks like. The last two columns are using the code you gave me. As you can see the columns at the top have missing data and still gives 12:00am in the last two columns. I would rather the last two columns be null.

 

ThanksPower BI Desktop Question.PNG

Hi @colem246,

 

Could you change the postion of the Or condition like( replace the fields with the correct names):

 

Or(isblank(), isblanck())

I will make a try when I get a computer with Powerbi desktop.

But let me know.

 

Ninter

Hi @colem246,

 

I tried the second approach proposed and it worked! 

Please try it and let me know if you have any issues.

 

IF(OR(ISBLANK('Activity First and Last'[First Arrival]),ISBLANK('Activity First and Last'[Activity Date])),BLANK(),'Activity First and Last'[Activity Date]-'Activity First and Last'[First Arrival])

Ninter

Hi Ninter,

 

I am still getting an error.Power BI.PNG

Hi @colem246,

 

Are you creating this calculation as a column and not a measure?

 

 I created as a calculated column. Let me know if it is the case.

 

Ninter

I am using measure for this because I am ultimately going to be calculating the average time of the first, last, etc.....

 

Using a calculated column wouldnt allow for this type manipulation will it? Also, I only want the time stamp to show, not date and time since date is already populated in the activity date column.

 

Thanks

Then use the formula with or with a combination of Datediff.

 

It should work...

 

Ninter.

Hi @colem246,

Have you resolved your issue? If you have, welcome to share your solution or mark the right reply as answer. More people will benefit from here.

Best Regards,
Angelia

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.