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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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