Forum Discussion

garythomannCoGC's avatar
garythomannCoGC
Impactful Individual
3 years ago
Solved

dax syntax - calculate(table) vs filter context transition and return confusion

Dax query to emulate power bi dashboard report table results.  Hierarchical model of parent (pml) < child (mbm) < child (mbpl). DaxStudio screenshot below.   "VAR pml_id" gives same error as shown....
  • OwenAuger's avatar
    OwenAuger
    3 years ago

    Yes, you've hit the nail on the head: "query tables" created with DEFINE TABLE cannot reference each other!

    But variables can 🙂

     

    I'm not sure if your query has evolved since your last post, but I would possibly suggest something like:

    EVALUATE
    VAR pml_id =
        -- pml.id = 3921
        CALCULATE (
            MAX ( 'Project Master List'[Id] ),
            'Project Master List'[DIR] = "CO",
            'Project Master List'[Initiative Name] = "Fleet Business Transformation"
        )
    VAR mbm =
        CALCULATETABLE (
            'Measure Benefit Master',
            'Measure Benefit Master'[DIR] = "CO",
            'Measure Benefit Master'[PM IDId] = pml_id
        )
    RETURN
        mbm