Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

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 accumulated in general and not by type of test. In the first photo you can see the general stock, but when choosing a type of "Essay" the same stock remains (Photo 2)

Kddk852_1-1652727359095.png

Here it should be the Stock = -28

Kddk852_2-1652727427961.png

Similarly I attach the code of the Measure:

Kddk852_3-1652727463922.png

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

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.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

I work for what I wanted, I also correct another problem I had when using the date filter, only correct a part since I made reference to another table but just change the name of the table and it worked, thank you very much!

Hi @Syndicate_Admin ,

 

Thanks for your feedback.

 

If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Best Regards,
Henry

v-henryk-mstf
Community Support
Community Support

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.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.