Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

The function expects a table expression for argument '', but a string or numeric expression was used

Hi there. With the following DAX I am trying to create two temporary tables: accive assets and inactive assets, and then  count all assets that do appear in "inactive" but not in "active" anymore (it...
  • MFelix's avatar
    1 year ago

    Hi Anonymous ,

     

    You are calculating in each of the variables a number and that cannot be used in the filter of the calculate try this instead:

    Churned assets =
    VAR active_assets = CALCULATETABLE(VALUES('CA'[AssetName]), FILTER ('CA','CA'[AssetState] = "Active") )
    VAR inactive_assets = CALCULATETABLE(VALUES('CA'[AssetName]), FILTER('CA','CA'[AssetState] = "Inactive") )
    
    RETURN
        CALCULATE(
            COUNT('CA'[AssetName]),
           'CA'[AssetName] IN inactive_assets,
           'CA'[AssetName] NOT IN active_assets
            )