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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PhiBu
Helper I
Helper I

Combine Filter and ALL in Measure

Hey, 

 

I want to combine the ALL and FILTER function:

I want to count a string from product table without responding to the customer table .

 

My current idea:

Measure =
CALCULATE(
COUNT( 'Product_Table'[value] ),
FILTER('Product_Table', 'Product_Table'[Product_Color] = "red"),
ALL(Customer_Data))
 
However, the measure is still affected by the Customer_Data Slicer in my Report. Any suggestions I'm missing?

Best regards, Philip!

1 ACCEPTED SOLUTION

Hi @PhiBu ,

 

Please use the following measure:

 

Measure =
CALCULATE (
    CALCULATE (
        COUNT ( 'Product_Table'[value] ),
        FILTER ( 'Product_Table', 'Product_Table'[Product_Color] = "red" )
    ),
    REMOVEFILTERS ( Customer_Data )
)

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @PhiBu 

I am not sure how your data model looks like, but I assume the measure is not considering the direction of a filter from customer_data table to product_table.

You may try to use Crossfilter function in your measure, or please share your sample pbix file's link, then I can try to have a look into it to come up with an accurate solution.

 

Thank you.

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

amitchandak
Super User
Super User

@PhiBu , this seems fine

Measure =
CALCULATE(
COUNT( 'Product_Table'[value] ),
FILTER('Product_Table', 'Product_Table'[Product_Color] = "red"),
removefilters(Customer_Data))

 

 

But you might end up getting data in one row

refer :https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak,

thanks to your fast reply.

I also tried the remove filter function. However, it seems to be ignored. The Customer_Date Slicer in my report still affects the measure. If I dont use the filter "FILTER('Product_Table', 'Product_Table'[Product_Color] = "red")", the masuere will not be affected by the Customer_Date Slicer.

Is there something I am missing? Can I not combine All and Filter function?

Best regards!

Hi @PhiBu ,

 

Please use the following measure:

 

Measure =
CALCULATE (
    CALCULATE (
        COUNT ( 'Product_Table'[value] ),
        FILTER ( 'Product_Table', 'Product_Table'[Product_Color] = "red" )
    ),
    REMOVEFILTERS ( Customer_Data )
)

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Thanks, using calculate two times was the point I missed!

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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.