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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
OsmanEmi
Frequent Visitor

Filtering error based on two columns

Hi,

 

I have the below dax expression and am trying to filter based on two rows however I get an error with the second filter that states
"A Function Filter has been used in a true or false expression"

Can someone explain to me the logic behind what im doing and why it's wrong.

Below is my dax measure

-Crew NA. = CALCULATE(COUNT(FACT_DELIVERY[CREW_QTY]),
FILTER(ALL(FACT_DELIVERY[CREW_QTY]),FACT_DELIVERY[CREW_QTY]<2)
&&
FILTER(ALL(FACT_DELIVERY[STOP_TYPE]),FACT_DELIVERY[STOP_TYPE] <> "C"))

Below is an example table:

Crew_qtystop_type
1c
1a
2a
3a

1 ACCEPTED SOLUTION
timg
Solution Sage
Solution Sage

Hi OsmanEmi,

could you change the && to , and try again?

 

-Crew NA. = CALCULATE(COUNT(FACT_DELIVERY[CREW_QTY]),
FILTER(ALL(FACT_DELIVERY[CREW_QTY]),FACT_DELIVERY[CREW_QTY]<2)
,
FILTER(ALL(FACT_DELIVERY[STOP_TYPE]),FACT_DELIVERY[STOP_TYPE] <> "C"))

 

The && function returns a TRUE or FALSE based on whether the conditions are met. by using the "," instead you are adding another filter to your calculate function, instead of turning it into a TRUE/FALSE.

 

Best regards,

Tim 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
tex628
Community Champion
Community Champion

Hi @OsmanEmi ;

You're using the "&&" inbetween two FILTER() statements.

"&&" doesn't work in the way that it says "Do this AND do that".
It basically says "This has to be TRUE and this other thing also has to be TRUE"

Try this instead:

-Crew NA. = 
CALCULATE(
COUNT(FACT_DELIVERY[CREW_QTY]) ,
FILTER(ALL(FACT_DELIVERY),FACT_DELIVERY[CREW_QTY]<2 && FACT_DELIVERY[STOP_TYPE] <> "C")
)

 


Connect on LinkedIn
timg
Solution Sage
Solution Sage

Hi OsmanEmi,

could you change the && to , and try again?

 

-Crew NA. = CALCULATE(COUNT(FACT_DELIVERY[CREW_QTY]),
FILTER(ALL(FACT_DELIVERY[CREW_QTY]),FACT_DELIVERY[CREW_QTY]<2)
,
FILTER(ALL(FACT_DELIVERY[STOP_TYPE]),FACT_DELIVERY[STOP_TYPE] <> "C"))

 

The && function returns a TRUE or FALSE based on whether the conditions are met. by using the "," instead you are adding another filter to your calculate function, instead of turning it into a TRUE/FALSE.

 

Best regards,

Tim 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




OsmanEmi
Frequent Visitor

Hi timg,

This worked thank you very much.
Is it possible to explain why this worked as opposed to my method?

Hi Osman,

I included an explanation as an edit in my first reply just now. Does this clarify the difference sufficiently?

Best regards,

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors