March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
Im trying to create a countif in DAX with multiple criteria below is an example, it works when I have the first section but the minute I add the && is shows zero results, im guessing im way off the mark on how to do this, thanks in advance
AppTest = CALCULATE(COUNT('app'[app_phase]),
FILTER(ALL('app'), [app_phase] = "complete"
&& [app_phase] = "almost complete"
&& [app_phase] = "delayed"
&& [app_phase] = "restarted"))
Solved! Go to Solution.
Hi @Brad333
The Problem is that you use an AND condition. What you are doing is you filter a table by checking whether a line has in column [app_phase] the values
complete" AND
"almost complete" AND
"delayed" AND
"restarted"
But since each line can in a column only have one value your if-check everytime returns FALSE which ends in an empty table. I am pretty sure that you need to use || instead of && because || is an OR condition. This means for each line itr will be checked in column [app_phase] has one of the four values and not all together.
So please try:
AppTest = CALCULATE(COUNT('app'[app_phase]),
FILTER(ALL('app'), [app_phase] = "complete"
|| [app_phase] = "almost complete"
|| [app_phase] = "delayed"
|| [app_phase] = "restarted"))
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
Hi @Brad333
The Problem is that you use an AND condition. What you are doing is you filter a table by checking whether a line has in column [app_phase] the values
complete" AND
"almost complete" AND
"delayed" AND
"restarted"
But since each line can in a column only have one value your if-check everytime returns FALSE which ends in an empty table. I am pretty sure that you need to use || instead of && because || is an OR condition. This means for each line itr will be checked in column [app_phase] has one of the four values and not all together.
So please try:
AppTest = CALCULATE(COUNT('app'[app_phase]),
FILTER(ALL('app'), [app_phase] = "complete"
|| [app_phase] = "almost complete"
|| [app_phase] = "delayed"
|| [app_phase] = "restarted"))
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |