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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Calculate and Filter question

Hello

 

The four measures below are calculating the total for the same product. 2 are filtering on the ProductID and 2 on the ProductName.

2 are using the FILTER function in calculate and 2 are using the calculate built in filter

When I add all 4 to a PBI report and a slicer only c is ignoring the filter context?

My question is why isn’t the first function (a) always returning the value and ignoring the filter?

 The only one that is c

 

EVALUATE
ROW ( "a", CALCULATE ( SUM ( SalesFact[Revenue] ), product[ProductID] = 92 ) )--> Expect it to Always returns total value for Product

EVALUATE
ROW (
    "b", CALCULATE (
        SUM ( SalesFact[Revenue] ),
        FILTER ( 'Product', product[ProductID] = 92 )
    )
)

EVALUATE
ROW ( "c", CALCULATE ( SUM ( SalesFact[Revenue] ), 'Product'[Product]="Abbas UM-19" ) )--> Always returns total value for Product

EVALUATE
ROW (
    "d", CALCULATE (
        SUM ( SalesFact[Revenue] ),
        FILTER (  'Product',  'Product'[Product]="Abbas UM-19" )
    )
)

Thank in advance.

3 REPLIES 3
lbendlin
Super User
Super User
Anonymous
Not applicable

Ibendlin

 

Thanks for the reply and the link, I think I understand the context transition but I'm still not sure why filters from the same table are producing different results? Why dose the field I filter on matter?

 

EVALUATE
ROW ( "a", CALCULATE ( SUM ( SalesFact[Revenue] ), 'Product'[ProductID] = 92 ) )

 

EVALUATE
ROW ( "c", CALCULATE ( SUM ( SalesFact[Revenue] ), 'Product'[Product]="Abbas UM-19" ) )

 

Thanks again.

 

I am not saying that I understand the article fully but I know the answer is in the article.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors