Forum Discussion
How to round a number from a specific date
Hi,
I need to roundup a number, but only from June onwards. For the other previous months of 2020, I don't want it to be rounded. I would like to do this within Power Query.
It's possible?
Example:
Hi Anonymous - use this formula:
= if [Date] > #date(2020,5,31) then Number.Round([Value], 1) else [Value]Just change the Number.Round() function to round to the number of decimal places you want, and adjust the #date() function as necessary. This will round all dates after May 31, 2020 to 1 decimal place, and for all other values, it will keep the original.
2 Replies
- edhans
Community Champion
Hi Anonymous - use this formula:
= if [Date] > #date(2020,5,31) then Number.Round([Value], 1) else [Value]Just change the Number.Round() function to round to the number of decimal places you want, and adjust the #date() function as necessary. This will round all dates after May 31, 2020 to 1 decimal place, and for all other values, it will keep the original.
- AnonymousNot applicable
Thank you @edhans. This will work for me, but is it possible to do this without creating a new column?
I'm sorry if my question is so basic, but I'm still learning M Language.