Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello! I need a 2nd pair of eyes on this Measure formula. I am new to using CALCULATE and am struggling a bit.
The table is called 'CDM Study metrics view'. The [Met GoLive Deadline] variable value is either null or "Yes".
What I want to do is count how many "Yes" there are when the Go Live Year is 2024. I've gone over and over this and can't figure out what I'm doing wrong. My error message is "The expression specified in the query is not a valid table expression".
Is it OK to use COUNT in a calculate function?
Solved! Go to Solution.
The filter function is returning a table, when you used it with a calculated, you have to use it only one time, instead of many calls of the function,
So the same code could be replaced by
Met GoLive 2024 =
CALCULATE(
COUNT('CDM Study Metrics view'[Met GoLive Deadline]),
FILTER(
'CDM Study Metrics view',
'CDM Study Metrics view'[Met GoLive Deadline] = "Yes" && 'CDM Study Metrics view'[Go Live Year] = 2024
)
)
I'm just using filter one time and using an AND to mix the condition,
As you are a beginner, you can also rembember that calculate don't need a filter call, so the following dax function should also work
Met GoLive 2024 =
CALCULATE(
COUNT('CDM Study Metrics view'[Met GoLive Deadline]),
'CDM Study Metrics view'[Met GoLive Deadline] = "Yes",
'CDM Study Metrics view'[Go Live Year] = 2024
)
And for your second question, YES, count can be used with calculate function
The filter function is returning a table, when you used it with a calculated, you have to use it only one time, instead of many calls of the function,
So the same code could be replaced by
Met GoLive 2024 =
CALCULATE(
COUNT('CDM Study Metrics view'[Met GoLive Deadline]),
FILTER(
'CDM Study Metrics view',
'CDM Study Metrics view'[Met GoLive Deadline] = "Yes" && 'CDM Study Metrics view'[Go Live Year] = 2024
)
)
I'm just using filter one time and using an AND to mix the condition,
As you are a beginner, you can also rembember that calculate don't need a filter call, so the following dax function should also work
Met GoLive 2024 =
CALCULATE(
COUNT('CDM Study Metrics view'[Met GoLive Deadline]),
'CDM Study Metrics view'[Met GoLive Deadline] = "Yes",
'CDM Study Metrics view'[Go Live Year] = 2024
)
And for your second question, YES, count can be used with calculate function
Thank you so much! This is very helpful!!!
This 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 |
---|---|
76 | |
76 | |
57 | |
37 | |
34 |
User | Count |
---|---|
99 | |
56 | |
56 | |
46 | |
40 |