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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ronnie7
Helper II
Helper II

Issue with Filter &&

Hi,

 

I have tried to create a new  column and using the following DAX code:

Incoming Messages = CALCULATE (
COUNTA(PS_Message[MessageName]),
FILTER (
ALL ( PS_Message[MessageName] ),
'PS_Message'[MessageName] = ("1 - Incoming")
&& 'PS_Message'[MessageName] = ("2 - Received")
&& 'PS_Message'[MessageName] = ("3 - Sent")

)
)

For some reason i don't get any results, however, if i try just one row (lets say the first one "1 - Incoming) it works.. each rows works by itself and i get a count, together it doesn't work.

 

Thanks in advance!

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

&& means all conditions are required. That formula will only return rows on which MessageName simultaneously is 1 - Incoming, 2- Received, and 3 - Sent. Which is impossible because one field can only have one value. You should be using || instead of &&.





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
KHorseman
Community Champion
Community Champion

&& means all conditions are required. That formula will only return rows on which MessageName simultaneously is 1 - Incoming, 2- Received, and 3 - Sent. Which is impossible because one field can only have one value. You should be using || instead of &&.





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

Proud to be a Super User!




Makes total sense! thanks!

@Ronnie7 

Hi, dude.
You can do something like this:

 
MeasureX = CALCULATE(
COUNTROWS(Table1);
FILTER(Table1;Table1[Column1] = "TEXT1"
&& Table1[Column1] = "TEXT2"
|| Table1[Column1] = "TEXT3"
|| Table1[Column1] = "TEXT4"
))


When you set the "&&" expression it will block all other values to pop-up "different from starting with ||", so after you can just add each one specified text with || expression.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.