Forum Discussion
What is wrong with this CALCULATE formula
- 1 year ago
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
- colettb1 year ago
Helper I
Thank you so much! This is very helpful!!!