Search code examples
sql-serverdaxtabular

Calculatetable in dax, including instead of excluding


I am trying to make a set of two organisationplaces, out of a total of 6 places in the table. Instead of excluding 4 places, can I rather include the two I want?

EVALUATE
(
summarize(
calculatetable
(
'Organisation',
'Organisation'[Level1] <> "WrongPlace1",
'Organisation'[Level1] <> "WrongPlace2",
'Organisation'[Level1] <> "WrongPlace3",
'Organisation'[Level1] <> "WrongPlace4",
),
'Organisation'[Level2]
)

)

Result:

Organisation[Level2]
Rightplace1
Rightplace2

Solution

  • I'm not sure I understood you correctly, but if you just want to explicitly filter two places you want, you could do something like this

    evaluate
    summarize
    (
        filter (
            'Organisation',
            or ('Organisation'[Level2] = "Rightplace1", 'Organisation'[Level2] = "Rightplace2")
        ), 
        'Organisation'[Level2]
    )