cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndersIskov
Level: Powered On

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
dynamicsedge
Level 10

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
dynamicsedge
Level 10

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

AndersIskov
Level: Powered On

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,248)