Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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 is clear tham before they became inactive they were active at some point). I get the error: The function expects a table expression for argument '', but a string or numeric expression was used. Would be grateful for your help.
Solved! Go to Solution.
Hi @JIli ,
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
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @JIli
can you please try the below dax.
Churned Assets =
VAR active_assets =
FILTER (
VALUES ( 'CA'[AssetName] ),
CALCULATE ( MAX ( 'CA'[AssetState] ) = "Active" )
)
VAR inactive_assets =
FILTER (
VALUES ( 'CA'[AssetName] ),
CALCULATE ( MAX ( 'CA'[AssetState] ) = "Inactive" )
)
VAR churned_assets =
EXCEPT ( inactive_assets, active_assets )
RETURN
COUNTROWS ( churned_assets )
If this answers your questions, Kindly accept it as a solution and give kudos.
Hi @JIli ,
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
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThis is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
56 | |
56 | |
38 | |
29 |
User | Count |
---|---|
75 | |
62 | |
45 | |
40 | |
39 |