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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Yaniv
Helper I
Helper I

Insert blank value based on another field

Hi,

 

I have a table named 'service'.

I want to create a new calucuated column that says if the field 'done' (date field) is blank do not insert any value but if the 'done' field is not blank insert the date value+one day.

Below what I already tried - 

 

1. NewColumn= IF(Service[Done]=BLANK(),BLANK(),Service[Done]+1) 

I get the error message - Column '' in Table '' contains blank values and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table.

 

2. NewColumn = IF(Service[Done]=BLANK()," ",Service[Done]+1)

Error message: Expressions that yield variant data-type cannot be used to define calculated columns.

 

Does anyone have an idea how to resolve it? I'm getting frustrated Smiley Happy

 

1 ACCEPTED SOLUTION

Hi @Yaniv,

 

I changed the data type of Service[Done] from Text to Date/Time, delete and recreate the calculated column Service[DoneDate], everything worked.

 

I have sent you the modified pbix file through private message.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

17 REPLIES 17
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Yaniv,

 

For this formula:  NewColumn = IF(Service[Done]=BLANK()," ",Service[Done]+1)

As " " is a string value, while Service[Done]+1 returns date value, two different data types cannot exist in a single column. Otherwise, variant data-type error will prompt.

 

For this formula: NewColumn= IF(Service[Done]=BLANK(),BLANK(),Service[Done]+1)

It works fine and returns expected date in my test. I didn't the same error. So, in your scenario, were you creating calculated column in service table? How many tables and columns are referred to in your formula? Please provide more information so that I can reproduce your problem.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft

 were you creating calculated column in service table? - Yes, the calcuated column is in the same table (service).

How many tables and columns are referred to in your formula? - Only 1 table and one column.

 

Thanks!!

Hi @Yaniv,

 

I cannot reproduce your problem. Please share some sample data so that I can test for you. Or, if possible, share your pbix file.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I hope the attached screenshot will make it clear.11.jpg

Hi @Yaniv,

 

I noticed that in formula, the source column is Service[Done], but in data view, you pointed out that source column is [Created], why? Also, from the error message, what is the "in Table" column? Did you created any relationship between this table and another table?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @v-yulgu-msft,

 

Yes, there is a mistake in the screenshot. The column source is done and not 'created' but they are same data type (date). I haven't created any relationship for this table.

Appreciate your assistance. 

 

Hi @Yaniv,

 

Could you please share your pbix file?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msft,How can I shre it with you? I haven't find an option to attach file to a message here.

Am I missing something? 

Hi @Yaniv,

 

Can you see this option when posting a reply?

4.PNG

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msft - Unfortunately, I can't. I just have the option ot attach an image file. 

Please see the screenshot below.

powerbi form.jpg

Hi @Yaniv,

 

As suggested in above link, could you please upload and share the sample files on OneDrive, Dropbox etc?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-yulgu-msft,

 

I sent you a private message.

 

Hi @Yaniv,

 

I changed the data type of Service[Done] from Text to Date/Time, delete and recreate the calculated column Service[DoneDate], everything worked.

 

I have sent you the modified pbix file through private message.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft,

 

I also tried to do that but the option of changing to date format was grayed out.

Can you please advise me how did you do that?

Hi @Yaniv,

 

Was my suggestion helpful to you? If yes, would you please kindly mark the corresponding reply as an answer?

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @v-yulgu-msft,

 

Yes, there is a mistake in the screenshot. The column source is done and not 'created' but they are same data type (date). I haven't created any relationship for this table.

Appreciate your assistance. 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.