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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

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:

Capturar.JPG

1 ACCEPTED SOLUTION
edhans
Super User
Super User

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.

edhans_0-1605626670061.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

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.

edhans_0-1605626670061.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not 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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors