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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mmm286b
Frequent Visitor

measure fileter by 2 values, one in measure another in slicer

Hi,

I need to have 3 cards Each one have a measure like these:

 

Medida 2 = 
CALCULATE (
    AVERAGE ( TablaConTotal[Jobs] ),FILTER ( ALL ( TablaConTotal ),  [SERVER] = "SERVERA"
     )
)

 

The difference betwen 3 measures is the Server.

Then I would like to have a slice where I can select the year to apply these measure in the card.

I'm trying it  but I see that if I put the filter command in the measure the slice don't works.

Any help? Thanks

1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Thank you danextian , dk_dk and anmolmalviya05 

Hi, @mmm286b 

Based on your description, I have the following sample data:

vjianpengmsft_0-1734420207687.png

You can choose from the following two DAX metric expressions to complete your calculations:

Measure = 
CALCULATE(AVERAGE('Table'[Jobs]),FILTER(ALLEXCEPT('Table','Table'[Year]),'Table'[SERVER] = "SERVERA"))
Measure1 = 
CALCULATE(AVERAGE('Table'[Jobs]),FILTER(ALL('Table'),'Table'[SERVER] = "SERVERA" && 'Table'[Year] IN VALUES('Table'[Year])))

Here are the results:

vjianpengmsft_1-1734420392115.png

I've provided the PBIX file used this time below.

 

 

Best Regards

Jianpeng Li

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

 

 

View solution in original post

4 REPLIES 4
v-jianpeng-msft
Community Support
Community Support

Thank you danextian , dk_dk and anmolmalviya05 

Hi, @mmm286b 

Based on your description, I have the following sample data:

vjianpengmsft_0-1734420207687.png

You can choose from the following two DAX metric expressions to complete your calculations:

Measure = 
CALCULATE(AVERAGE('Table'[Jobs]),FILTER(ALLEXCEPT('Table','Table'[Year]),'Table'[SERVER] = "SERVERA"))
Measure1 = 
CALCULATE(AVERAGE('Table'[Jobs]),FILTER(ALL('Table'),'Table'[SERVER] = "SERVERA" && 'Table'[Year] IN VALUES('Table'[Year])))

Here are the results:

vjianpengmsft_1-1734420392115.png

I've provided the PBIX file used this time below.

 

 

Best Regards

Jianpeng Li

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

 

 

danextian
Super User
Super User

Hi @mmm286b 

 

I am assuming that the year is coming from the same table TablaConTotal. ALL(TablaConTotal) removes any existing filters on the TablaConTotal table and ensures the FILTER function evaluates the condition across all rows in the table, regardless of any active filters in the current context that is why your year filter doesnt work. 

Try this:

Medida 2 = 
CALCULATE (
    AVERAGE ( TablaConTotal[Jobs] ),FILTER ( TablaConTotal,  [SERVER] = "SERVERA"
     )
)

 

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
dk_dk
Super User
Super User

Hi @mmm286b 

Why do you need the ALL ( TablaConTotal ) condition? You most likely need to modify the filter conditions in your CALCULATE to "allow" the years to filter the card again through the slicer. Could you provide a sample of your data tables, the relationships between them, and what columns you are using in the slicer?




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

Proud to be a Super User!





anmolmalviya05
Super User
Super User

Hi @mmm286b, Please try below measure:

Medida 2 =
CALCULATE(
AVERAGE(TablaConTotal[Jobs]),
TablaConTotal[SERVER] = "SERVERA"
)

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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