DAX query on filter in Power BI

  • Hi

    I have created a DAX formula that counts an attribute based on a filter.

    Is it possible to have a filter coming from two different dimension groups.

     

    In the example below, I want to count all Table A field A records where the TableA.field3 = 1 and TableB.Field2 =2 .

     

    CALCULATE(COUNT('TableA'[FieldA]), Filter('TableA', [Field3] = "1"  &&

    ('TableB'[Field2] = "2" )))

     

    When I try and create the TableB Field 2 part of the DAX query, it is relating back to Table A.

  • Maybe this? You don't need FILTER() if you are comparing a column value to a constant. You would need it if you were comparing a column to an aggregate.

    CALCULATE (
     COUNTROWS('TableA'),
     TableA[Field3]=1 && TableB[Field2]=2
     )

    If that doesn't solve your problem, could you describe it in terms of the AdventureWorks DW schema? (Just makes it easier to model).

    • This reply was modified 4 years, 11 months ago by  pietlinden.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply