Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
4 years ago
Solved

Problem with Measure and Filter

Hello, I hope you can help me, I have a Measure where the accumulated "stocks" is calculated, however, when I want to apply a filter on the types of tests to be carried out, it shows me the accumulat...
  • v-henryk-mstf's avatar
    4 years ago

    Hi Syndicate_Admin ,

     

    According to the formula you provided, the reason for this kind of problem is that the formula uses the all function, which clears all filters of the table, so when you filter the values in the filter, it does not affect Stock.
    You can try the following formula (keeping the filter results for the ensyo field).

    M =
    VAR ent =
        CALCULATE (
            COUNTROWS ( MiniEntrada ),
            FILTER (
                ALLEXCEPT ( MiniEntrada, MiniEntrada[Ensayo] ),
                MiniEntrada[ENT_STA] = "IN"
                    && MiniEntrada[ENT_FECHA] <= MIN ( MiniEntrada[ENT_FECHA] )
            )
        )
    VAR pro =
        CALCULATE (
            COUNTROWS ( MiniProd ),
            FILTER (
                ALLEXCEPT ( MiniProd, MiniProd[Ensayo] ),
                MiniEntrada[ENT_STA] = "out"
                    && MiniProd[ENT_FECHA] <= MIN ( MiniProd[ENT_FECHA] )
            )
        )
    RETURN
        ent - pro


    If the problem is still not resolved, please provide detailed error information and And provide test data to facilitate me to solve for you as soon as possible. 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.