Number.Mod rescue pack for Power BI and Power Query

If you use the M-function Number.Mod in Power BI or Power Query and expect the same result like in Excel or DAX, you are probably in good company.

But if the signs of the number and the divisor are not the same, M will differ from Excel and DAX:

Number.Mod in M is different

This is by design, so you can use this this formula instead, if you need matching results:

[Number] – [Divisor] * Number.RoundDown( [Number] / [Divisor] )

Enjoy & stay queryious ­čÖé

Comments (2) Write a comment

  1. Pingback: #Excel Super Links #151 | Excel For You

  2. It means that in case of negative numbers PQ rounds toward zero instead of rounding down. New math is coming! But the best part is “This is by design” comment, simply incredible! It opens door for any stupid solution when you add “this is by design”.
    Thank you for your usual percipient watch, this is by design of course :).

    CezarP

    Reply

Leave a Reply