Forum Discussion

robarivas's avatar
robarivas
Post Patron
4 years ago
Solved

Nested Filter DAX Query

Would anyone be able to tell me how to fix this DAX Query?   It gives me the error: SummarizeColumns() and AddMissingItems() may not be used in this context.   The general pattern for writing a D...
  • SpartaBI's avatar
    4 years ago

    robarivas you should not use CALCULATETABLE on top of SUMMARIZECOLUMNS.
    You can achieve the same by using the filter parameter inside SUMMARIZECOLUMNS.
    So, you should write your code like this:

     

     

     

    SUMMARIZECOLUMNS (
        'DimTable1'[Field_A],
        'DimTable1'[Field_G],
        FILTER(
            ALL('DimTable4'[Field K]),
            'DimTable4'[Field K] = "Revenue"
        ),
        FILTER(
            ALL('DimTable1'[Field_A],'DimTable1'[Field_G]),
            'DimTable1'[Field_A] IN { "West", "East" } 
               || ( 'DimTable1'[Field_G] IN { "Red", "Blue" } && 'DimTable1'[Field_A] = "" )
        ),
        "Total Amount", [Total Amount]
    )

     

     

     


     In case it solved your question, please mark this as a solution. Appreciate your Kudos