Count 1 for every 22 in a column - DAX

Viewed 26

I have a column that shows the total number of tons a customer has ready at our different locations. What I want to do is have a formula that counts 1 for every 22 tons that occur in the ready product column. For example. If ready = 44, I would want my count to show 2, if ready = 43, count should be 1.

My code is as follows:

Available to Ship =
IF (
    SOP_LOM2_Deliveries[Mode] = "Truck" || SOP_LOM2_Deliveries[Mode] = "Truck",
    ROUNDDOWN ( SOP_LOM2_Deliveries[Tons] / FLOOR ( 22, 1 ), 1 )
)

Right now the results I get vary. Sometimes I get incorrect numbers

wrong numbers

and other times I get correct numbers

correct count

Could anyone advise me on what I'm doing wrong here? Thank you!

1 Answers

As simple as this:

Available to Ship =
IF (
    SOP_LOM2_Deliveries[Mode] = "Truck" || SOP_LOM2_Deliveries[Mode] = "Truck",
    ROUNDDOWN ( SOP_LOM2_Deliveries[Tons] / 22, 0 )
)

enter image description here

Related