Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Brighton10
Helper II
Helper II

sum of distinct boolean values

Greetings everyone. I have an alarmStatus column that contains "ON"/"OFF" and would like to count the sum of distinct text when i filter using the country. For example Nigeria, Owo,Amos fashanu will have a countrows equals to 4 (datetime = 2021-02-02)when the alarmStatus is ON and Rabiu Azeez will have count of zero (0) because it is OFF. How can i write a DAX to calculate that? The last Column is for the DieselFlowOver40 Count. Thanks 

Desired Resultdesiredresult.PNG

The data Tables

reportv3off.PNGreportV2.PNG

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Brighton10 update measure and then check

 

Count On = 
CALCULATE ( COUNTROWS( Table ), 
KEEPFILTERS(Table[AlarmCode] = "DieselFlowOver40"), 
KEEPFILTERS(Table[AlarmStatus]  = "On" )
) + 0


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
parry2k
Super User
Super User

@Brighton10 I just looked at the file and added the measure I provided previously, and I get the following result. What is the issue with it?

 

parry2k_0-1612542358619.png

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k , thats correct and i added a date filter to that measure as well. 

parry2k
Super User
Super User

@Brighton10 yes that will be very helpful, I'm not seeing the full picture.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Brighton10 update measure and then check

 

Count On = 
CALCULATE ( COUNTROWS( Table ), 
KEEPFILTERS(Table[AlarmCode] = "DieselFlowOver40"), 
KEEPFILTERS(Table[AlarmStatus]  = "On" )
) + 0


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Its still the same, Let me share my pbix file and have a look from there 

 

parry2k
Super User
Super User

@Brighton10 you can change the measure as below and test it 

 

Count On = 
CALCULATE ( COUNTROWS( Table ), Table[AlarmCode] = "DieselFlowOver40", Table[AlarmStatus]  = "On" ) + 0

 

do test the measure in the visual and if it doesn't work, come back with details, explaining what is not working and what are the expectations.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

This measure works by counting the rows per country when its ON. When I include a region and Sitename filters its showing the sum value for all the sitenames. I want it to show on the specific sitename where it was ON, where it was OFF should be 0.error.PNG

parry2k
Super User
Super User

@Brighton10 not sure fully understood but add this measure and use it in visual and see if that gets you what you are looking for

 

Count On = 
CALCULATE ( COUNTROWS( Table ), Table[AlarmStatus]  = "On" ) + 0

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k  thanks for your response. So basically I want to create a calculated measure/column to show the distinct count when alarmCode=DieselFlowOver40 per day. So when the alarmStatus is OFF the count should always equal zero and when ON we count the number of rows. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors