Forum Discussion
Power BI roundup not calculating correctly
- 1 year ago
Hi RealTrentG ,
Thank you for reaching out to Microsoft Community.
I hope the below measure works as per your requirement.MERCH REQD = ROUNDUP(SUM('Table (2)'[PIECES]) / 3000, 0)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Chaithra E.
hello RealTrentG
i tried your DAX and show right value of rounding
however, the line 4 shows off value, 2,37 become 3,00.
Then you might want to use ROUND()
with ROUND(), 2,37 become 2,00
Thank you.
Thanks for the reply Irwan. It is still not calculating correctly, but I think I know why. I am summing two records together and PowerBI is summing the columns of each, rather than using the summed value, see below.
This one is good, calculating correctly
...but when I include a group by column, I get the below.
So the total PIECES of 7,793 is correct, but the MERCH REQD column (formerly Roundup Col), should be 3, not 4. Seems in the background Power BI is adding the two individual records from first screen shot above rather than performing a new calc on the grouped PIECES column. Any thoughts on how to prevent this?
Thanks!
- Irwan1 year ago
Super User
hello RealTrentG
yes, as you mentioned table visual total value is summing so 3,00 +1,00.
you need to change [MERCH REQD] so it will collect 3,00.
if you want to get that 3,00, then you might want to use MAX for [MERCH REQD] instead of SUM because you want to get the highest value.
Thank you.
- RealTrentG1 year agoFrequent Visitor
Not exactly. I want so sum the pieces first and then calculate the MERCH REQD. In this example, it works out that I should end up with 3.00 since 7,793/3,000 = 2.6, which rounds up to 3.00. But in the scenario below, if I use the MAX function I would end up with 3.00 MERCH REQD, but I should have 5.00 based on the Total PIECES of 12,500 (12,500/3,000 = 4.17, roundup to 5.00)
Type PIECES Divide 3,000 Roundup/MERCH REQD A 8,000 2.67 3.00 B 4,500 1.50 2.00 TOTAL 12,500 4.17 5.00 Thanks again
- Irwan1 year ago
Super User
hello RealTrentG
i am confused.
based on your previous post, i assumed you want to get the max value then use MAX.
if you want to get sum, then use sum.
Total calculation in table is based on what function you are using.
using ROUND() to round closest value
using ROUNDUP() to roundup closest value.
Thank you.