Forum Discussion

jaryszek's avatar
jaryszek
Icon for Super User rankSuper User
9 months ago
Solved

Query time is too big when adding one column to table. How to approach the problem?

I have a DAX query that performs well, but when I add a single additional column  Dim_EA_AmortizedCosts_Resources[ResourceType] — the query time increases dramatically and often exceeds the timeou...
  • Zanqueta's avatar
    9 months ago

    Hi jaryszek 

     

    When you say adding a single column such as Dim_EA_AmortizedCosts_Resources[ResourceType] causes a dramatic slowdown, it usually points to cardinality and Auto-Exists behaviour in DAX combined with the query shape. Here is how to approach the diagnosis:

     

     

    • Cardinality explosion: Adding a column from a dimension with high cardinality multiplies the number of groups in SUMMARIZECOLUMNS(). If ResourceType has thousands of distinct values, the engine must compute many more combinations.
    • Auto-Exists logic: When multiple dimensions are grouped, the engine checks valid combinations across relationships. This can be expensive if the relationships involve large tables.
    • ROLLUPGROUP and subtotals: Using ROLLUPADDISSUBTOTAL adds extra complexity because the engine calculates subtotals for every grouping level.

     

    Use Server Timings and Query Plan
     
    • Enable Performance Analyzer Look for:
      • Storage Engine scans: Are they increasing significantly?
      • Formula Engine operations: Is there a large increase in rows processed?

     

    Test Without ROLLUP
    • Remove ROLLUPGROUP and ROLLUPADDISSUBTOTAL temporarily.
    • Compare timings to confirm if subtotals are the main driver.

     

     

    The last comment, cannot you simplify this query?

     

    SUMMARIZECOLUMNS(
        'Dim_EA_Resource_TagKeys'[Key],
        'Dim_EA_Resource_TagKeys'[Value],
        'Dim_EA_AmortizedCosts_Resources'[ResourceType],
        "New_AmortizedCosts", [New_AmortizedCosts]
    )

     

    If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.

    Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.