cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

BudgetFields gets divided wrong when Duration is not in whole number

Hi,

 

In my application, each project will have a given client budget ("CurrentBudget"), start date ("EstimatedStart") and a duration which is in days ("DurationInDays").

 

Ideally what I would like is for each of the fields of Months: Jan2020,Feb2020,Mar2020.............Jan2021,etc. To be filled automatically when the above data gets inserted. With the help from this community, I am currently using this following function for the Default property of each of the Month fields:

 

 

 

If(Toggle3.Value = true,
If(2020=Year(EstimatedStart.SelectedDate)&&2>=Month(EstimatedStart.SelectedDate)&&2<=Month(DateAdd(EstimatedStart.SelectedDate,Value(DurationDaysDataCardValue.Text),Days)),

(If((Value(DurationDaysDataCardValue.Text)<=30),(Value(CurrentBudgetDataCard.Text)), (Value(CurrentBudgetDataCard.Text)/(Value(DurationDaysDataCardValue.Text)/30)))),0),false)

 

 

It works ideally if one start with the 1st in the month and use whole numbers to convert the Days into Month (30,60,90,120), however, if the number is for example 45 days (1.5 month) then the number gets calculated wrong:

 

AddBudgetToMonths7.JPG

 

Can anyone help me in how I make sure that the DurationInDaysDataCard/30 will always make sure to round up to the first whole number? In this case instead of dividing 110k with 1.5 it should round up to 2.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Participant
Power Participant

Re: BudgetFields gets divided wrong when Duration is not in whole number

@AndersIskov 

 

You can consider RoundUp(Number,0) to always round up to next whole number.

 

Or use Round(Number,0) to respect regular rounding rules.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-round

View solution in original post

2 REPLIES 2
Highlighted
Power Participant
Power Participant

Re: BudgetFields gets divided wrong when Duration is not in whole number

@AndersIskov 

 

You can consider RoundUp(Number,0) to always round up to next whole number.

 

Or use Round(Number,0) to respect regular rounding rules.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-round

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: BudgetFields gets divided wrong when Duration is not in whole number

I just found that function as well by Googling. Funny how it helps typing out the problem and then thinking about it again 🙂

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,132)