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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Can we add filter to an existing measure from Direct Query?

Hello.

Let's say I am connecting to a DirectQuery dataset, and it has a measure called "Total Sales". Can I create my own measure, and use the existing "Total Sales" measure, but using Calculate() and add additional filter, for example colour="red"?

Example below:

CALCULATE(
   [Total Sales],           // this is from a DirectQuery connection
   Table[Colour] = "Green"  // this is what I want to add
)

 

Does anyone know if this should work? I tried doing this, but my numbers doesn't change at all even after adding that colour filter.

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

pls try this

CALCULATE(
   [Total Sales],  
   FILTER(ALL('Table',Table[Colour] = "Green")  
)

View solution in original post

Anonymous
Not applicable

Thank you @Ahmedx . Apparently yours, and even the one in my example, works. It's just that the visual doesn't refresh properly after I changed the visual, so it looked like it didn't work, when in fact it did.

View solution in original post

3 REPLIES 3
Ahmedx
Super User
Super User

pls try this

CALCULATE(
   [Total Sales],  
   FILTER(ALL('Table',Table[Colour] = "Green")  
)
Anonymous
Not applicable

Thank you @Ahmedx . Apparently yours, and even the one in my example, works. It's just that the visual doesn't refresh properly after I changed the visual, so it looked like it didn't work, when in fact it did.

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

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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