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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gpiero
Skilled Sharer
Skilled Sharer

How to include more FILTER() in a DAX formula

 

I have the following measure that works properly.

 

NoDelivPGDistrDPL =
CALCULATE (
    COUNTAX ( ZCSDLV; ZCSDLV[c1] );
    DISTINCT ( ZCSDLV[c1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER ( ZCSDLV; ZCSDLV[Pae1] = "CN" )
    )

 

Now I need to include other FILTER() as showed below but it returns an empty value

 

NoDelivPGDistrDPL =
CALCULATE (
    COUNTAX ( ZCSDLV; ZCSDLV[C1] );
    DISTINCT ( ZCSDLV[C1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER ( ZCSDLV; ZCSDLV[Pae1] = "CN" );
    FILTER ( ZCSDLV; ZCSDLV[Pae1] = "MX" );
    FILTER ( ZCSDLV; ZCSDLV[Pae1] = "AR" );
    FILTER ( ZCSDLV; ZCSDLV[Pae1] = "RU" )
)

I tried to use COUNTROWS instead of COUNTAX  and filtering "CN" "MX" "AR" "RU" before [cod1] and [Org1] and I got always an empty values.

 

 

I know it should be easy but I did not understand how to apply a multiple filter in this case.

 

Could you kindly indicate to me where is the mistake'

 

Thanks a lot

If I can...
1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

This should work...

 

NoDelivPGDistrDPL =
CALCULATE (
    COUNTAX ( ZCSDLV; ZCSDLV[C1] );
    DISTINCT ( ZCSDLV[C1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER (
        ZCSDLV;
        ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU"
    )
)

This should actually give you same as above...

 

NoDelivPGDistrDPL =
CALCULATE (
    DISTINCTCOUNT ( ZCSDLV[C1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER (
        ZCSDLV;
        ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU"
    )
)

 But I would actually simplify even further like this...

 

NoDelivPGDistrDPL =
CALCULATE (
    DISTINCTCOUNT ( ZCSDLV[C1] );
    FILTER (
        ZCSDLV;
        ZCSDLV[Cod1] = "149"
            && ZCSDLV[Org1] = "MDCS"
            && ( ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU" )
    )
)

Hope this helps! Smiley Happy

View solution in original post

2 REPLIES 2
Sean
Community Champion
Community Champion

This should work...

 

NoDelivPGDistrDPL =
CALCULATE (
    COUNTAX ( ZCSDLV; ZCSDLV[C1] );
    DISTINCT ( ZCSDLV[C1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER (
        ZCSDLV;
        ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU"
    )
)

This should actually give you same as above...

 

NoDelivPGDistrDPL =
CALCULATE (
    DISTINCTCOUNT ( ZCSDLV[C1] );
    FILTER ( ZCSDLV; ZCSDLV[Cod1] = "149" );
    FILTER ( ZCSDLV; ZCSDLV[Org1] = "MDCS" );
    FILTER (
        ZCSDLV;
        ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU"
    )
)

 But I would actually simplify even further like this...

 

NoDelivPGDistrDPL =
CALCULATE (
    DISTINCTCOUNT ( ZCSDLV[C1] );
    FILTER (
        ZCSDLV;
        ZCSDLV[Cod1] = "149"
            && ZCSDLV[Org1] = "MDCS"
            && ( ZCSDLV[Pae1] = "CN"
            || ZCSDLV[Pae1] = "MX"
            || ZCSDLV[Pae1] = "AR"
            || ZCSDLV[Pae1] = "RU" )
    )
)

Hope this helps! Smiley Happy

@Sean

Thank you, it works

gpiero

If I can...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors