Forum Discussion

andrewsk's avatar
andrewsk
Regular Visitor
8 years ago
Solved

FILTER on multiple tables

Hi all. I am new to DAX and am having a hard time getting my head around the FILTER command.   I want to Filter Data based off of multiple tables (Properly joined via many to one relationships) Her...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    Hi andrewsk

     

    As a NEW TABLE, try this

     

    New Table=
    FILTER (
        'Product Data',
        'Product Data'[ProductCategory] = "Mountain Bikes"
            && CALCULATE ( AVERAGE ( 'Sales Data'[Unit Price] ) > 1000 )
    )


    FILTER function is an interator. All ITERATORs (like FILTER,SUMX,MAXX etc) work in folllowing fashion.
    1) They create a ROW context on the TABLE received as first argument

    2) They evaluate the second expression for each ROW of that TABLE


    However FILTER only provides ROW context and not the FILTER context.
    Calculate transforms that row context into filter context allowing you to work with relationships