Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hello Wonderful people
An example of the countifs formula with multiple conditions I am currently using in Excel is given below. I wish to replicate the same formula in PowerQuery in PB:
=COUNTIFS(Append1!$BF:$BF,">=01/01/2020",Append1!$BF:$BF,"<18/11/2022",Append1!$D:$D,"<>24 Application withdrawn")
At the moment, I am using the filter option to filter out the 24 Application withdrawn condition but it's better to use a SQL to do the job!
I know it's NOT going to be easy in PB.
Thank you in advance.
Solved! Go to Solution.
Hi @Anonymous ,
This is my test data.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@neekotang, thank you. This works in SSMS.
@neeko tang, does your syntax work in PowerBI or SSMS?
Hi @Anonymous ,
This is my test data.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You can use the following SQL statements.
select count(*)
from table
where date >= '2020-01-01' and date <= '2022-11-18' and column <> '24 Application withdrawn'
You also can refer to the following posts that may be helpful to you:
SQL Countif function - Stack Overflow
sql - How to do countIf() in Oracle - Stack Overflow
COUNTIF in SQL: COUNT(CASE WHEN … THEN 1 END) (modern-sql.com)
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , If I have understood you correctly, and assuming that your data model is something similar to this:
- Create a custom column, and insert this formule:
if [Date]>= Date.FromText("2020-01-01") and
[Date]<= Date.FromText("2022-11-18") and
[Column]<>"<> 24 Application withdrawn"
then 1 else 0
- The result:
Best regards
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
72 | |
67 | |
65 | |
43 | |
42 |
User | Count |
---|---|
47 | |
38 | |
28 | |
28 | |
27 |