Forum Discussion

shuhn1229's avatar
shuhn1229
Resolver I
1 year ago
Solved

Optimizing DAX Logic

Hi all,   I am working with a large semantic model with about 10M records. The data quality is not the best.   My data model involves cars and car parts (imaginary). The grain for my fact table i...
  • Kedar_Pande's avatar
    1 year ago

    shuhn1229 

    If the fallback logic (SelectedType when SelectedCategory is blank) is static, consider adding a calculated column in the fact table. This will avoid runtime computation:

    PreferredCategory =
    IF (
    ISBLANK('Total Inventory'[Hoods]),
    RELATED(Cars[Hoods]),
    'Total Inventory'[Hoods]
    )

    Then, in your measure, directly reference this column instead of recalculating it:

    Optimized Measure with Column =
    VAR SelectedAnalysisType = SELECTEDVALUE('Total Inventory'[Type])
    RETURN
    IF (
    SelectedAnalysisType = "Pontiac",
    SELECTEDVALUE('Total Inventory'[PreferredCategory]),
    BLANK()
    )

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn