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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dorsey
Regular Visitor

trouble with calculated column

Hello,

 

First sorry for my english.

I'm a very newby on powerBI but everything becom with a start no ?

I've a table with some column :

- [first] date for when the holiday start ,

- [second] date for when the holiday finish

- [third] who calculate the the day between this two date  expect unwork day and weekend, with DAX function (working at this point)

- [forth]one with 3 value (day, amp, pm)

everything is fine but I want to create an other colunn [Five] who say " if [forth} ="day", [Five] = [Third] else [Five] = 0,5 "

 

For that I've try this : 

Colonne = IF([forth]="day",[third],"0,5")
 
but I've an error like :  Expressions that return a variant data type cannot be used to define calculated columns.

 Do you have an idea to help me ?

 

Thank you very mush

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @dorsey ,

 

that usually happens when you mix data types.

I guess [third] is number, no? Then try it like this:

Colonne = IF( [forth]="day", [third], 0.5)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

4 REPLIES 4
dorsey
Regular Visitor

Hello,

 

 and thank you for your two help. It's working and it's awsome !!

 

Nothing for you maybe but for me it's a big start !

 

regards

Hey @dorsey ,

 

I'm happy it works now 😊

The beginning is always the hardest. Keep going and things will become more and more easy. And we can always help you here in the community.

 

Best regards

Denis

selimovd
Super User
Super User

Hey @dorsey ,

 

that usually happens when you mix data types.

I guess [third] is number, no? Then try it like this:

Colonne = IF( [forth]="day", [third], 0.5)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
HotChilli
Super User
Super User

the 2 return paths of an IF statement have to return the same datatype.  It looks like the code returns an integer or a string so that's what you need to fix.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors