Forum Discussion

Gschie's avatar
Gschie
New Member
10 years ago
Solved

How to filter data based om another filed in the database

Hello   I am new in this DAX language, so please help me.   I have at table it contains Amount and accountnumbers.   AcAm = Amount AcNo = AcountNr   I want to sum(AcAM where AcNo >3000 and A...
  • greggyb's avatar
    10 years ago

    First, does this need to be hard-coded into a measure, or can you get away with using filters in your report?

     

    If this needs to be in a measure, it's a simple call to CALCULATE():

     

    Amount =
    SUM( 'MyTable'[AcAm] )
    
    Filtered Amount =
    CALCULATE(
        [Amount]
        ,'MyTable'[AcNo] > 3000
        ,'MyTable'[AcAm] < 4000
    )

    CALCULATE() allows you to define simple predicates to filter expressions, or complex table expressions to define the context for the expression. All arguments 2-N of CALCULATE() are evaluated in a logical and.