This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hi,
I have 1 Question Related to Power Query
This is my Table from Column A to E and I need to calculate it in DAX
I know How to calculate it in Excel but not in Dax
In Excel, we can use Count if Function but in DAX it looks like a Trickey
Solved! Go to Solution.
Hi @Anonymous ,
You are right, that this is not as trivial as in Excel. Normally you would need to do some unpivoting on your table to get your result as explained here:
Solved: Power Query - count across columns if condition me... - Microsoft Power BI Community
However, a quick and dirty solution could be something like this:
Here the code:
TomsNewCountColumn = IF ( 'Table12'[A] = TRUE, 1, 0) + IF ( 'Table12'[B] = TRUE, 1, 0) + IF ( 'Table12'[C] = TRUE, 1, 0) + IF ( 'Table12'[D] = TRUE, 1, 0) + IF ( 'Table12'[E] = TRUE, 1, 0)
Be aware though that this is not scalable and I would always go for some proper changes on your table before applying the code above. However, since your query was to count all trues accross columns, it might still work for you 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Use PQ,
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi @Anonymous ,
You are right, that this is not as trivial as in Excel. Normally you would need to do some unpivoting on your table to get your result as explained here:
Solved: Power Query - count across columns if condition me... - Microsoft Power BI Community
However, a quick and dirty solution could be something like this:
Here the code:
TomsNewCountColumn = IF ( 'Table12'[A] = TRUE, 1, 0) + IF ( 'Table12'[B] = TRUE, 1, 0) + IF ( 'Table12'[C] = TRUE, 1, 0) + IF ( 'Table12'[D] = TRUE, 1, 0) + IF ( 'Table12'[E] = TRUE, 1, 0)
Be aware though that this is not scalable and I would always go for some proper changes on your table before applying the code above. However, since your query was to count all trues accross columns, it might still work for you 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 30 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 63 | |
| 53 | |
| 31 | |
| 23 | |
| 23 |