Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculate function using Containsstring filter not working as expected

Hey Guys,   I'm sure I'm missing something small in the syntax here but I've tried this DAX measure about every way possible the past couple days without any luck.    I have a table called 'vw_sh...
  • v-cazheng-msft's avatar
    4 years ago

    Hi Anonymous ,

     

    Maybe you could try this Measure.

    ACT% =
    DIVIDE (
        CALCULATE (
            SUM ( vw_shrinkage_act[Total_Hrs] ),
            FILTER ( vw_shrinkage_act, vw_shrinkage_act[Shrinkage_cat_code] <> "SHIFT" )
        ),
        CALCULATE (
            SUM ( vw_shrinkage_act[Total_Hrs] ),
            CONTAINSSTRING ( vw_shrinkage_act[Shrinkage_cat_code], "SHIFT" )
        )
    )

     

    Then the result will look like this:

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

     

    Best Regards,

    Community Support Team _ Caiyun