Forum Discussion

mdhenzel's avatar
mdhenzel
Frequent Visitor
4 years ago

Help With a Measure that will pull one number based on condition, another if not.

Hi All,

 

I am stuck on a measure. I am trying to write an if statement to look at units needed in a month. If we have inventory, return the amount of units, if we do not have enough inventory to cover the order, return the previous running inventory number. 

 

This will be used to make a % of units ready to be shipped. In the below, the "Units On Hand and Ready" for july should read "15", not the "-2" "Inv. Running" is a measure. The last part of the "IF" in Var Num should be "Inv. Running" with a filter taking it back to the previous amount (15)

 

 

1 Reply

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi mdhenzel ,

     

    It seems that the filter is causing the cause, try the following formula.

    Units On Hand and Ready =
    IF (
        [Inv. Running] >= 0,
        CALCULATE ( SUM ( 'Ready To Ship'[Orders to ship] ), ALL ( 'Ready To Ship' ) ),
        IF ( [Inv. Running] < 0, [Inv. Running], 0 )
    )


    If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.