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

Calculate Month from Number of Days

Hello,

 

I have a column in the dataset that specifies the number of days(num_ofDays) which is of the type integer.

I'm trying to create a new column called month that lets me determine the month based on number of days.

 

The formula I'm trying to use is Ceiling(num_ofDays/30.5, 1)

 

Using this formula causes Power BI to throw an error & hangup & lose all progress on reports. The error Im getting is 

Unable to cast object of type System.Decimal to System.char
 
I tried replacing Ceiling with Round & Integer & they work just fine except that I'm not really getting the correct numbers.
Is there anything I'm missing?
 
Thanks,
Samantha
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@sam245gonsalves 

This could be a data conversion issue, check your data source and the data types of the columns try to do it on a small sample of your data.

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @sam245gonsalves 

 

You may try the following calculated column to see if it works.

M = ROUNDUP([NumOfDays]/30.5,0)

 

Result:

b1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@sam245gonsalves 

This could be a data conversion issue, check your data source and the data types of the columns try to do it on a small sample of your data.

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hey @Fowmy 

 

Thanks, I tried the above but it still causes the entire application window to freeze

I tried the roundup function as well - with the same results.

Fowmy
Super User
Super User

@sam245gonsalves 

 

It should work, try the fully qualified column name

 

New Column = Ceiling(Table[num_ofDays]/30.5, 1)

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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