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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
rweb95
Frequent Visitor

Column Distinct Count with Several Conditions

Hello everyone!

 

I need help getting a distinct count of names within a column with several conditions applied.

Here is a sample of the data I'm working with:

 

UtilityNameRateScheduleNameIsDefaultIsActiveCompanyId

F Electric

Husker False11
F ElectricGeneral ServiceTrueTrue 
F ElectricGeneral ServiceTrueTrue 
F ElectricGlacial EnergyFalseTrue12
F ElectricIrrigationTrueTrue 
F ElectricIrrigationTrueTrue 
F ElectricLarge CommercialTrueTrue 
F ElectricLarge CommercialTrueTrue 
F ElectricLarge Commercial Load ControlTrueTrue 
F ElectricLarge Commercial Load ControlTrueTrue 
F ElectricResidential & Small BusinessTrueTrue 
F ElectricResidential & Small BusinessTrueTrue 

 

I want to count the number of distinct names in the 'RateSchedule - Current'[RateScheduleName]

 

Here is the formula I tried to use:

 

NumberOfRates =

IF('RateSchedule - Current'[IsActive] = TRUE()
&& 'RateSchedule - Current'[CompanyId] = BLANK()
&& 'RateSchedule - Current'[IsDefault] = TRUE(),
DISTINCTCOUNT('RateSchedule - Current'[RateScheduleName]))
 
From the table above, F Electric should have a distinct count of 5 in the 'RateSchedule - Current'[RateScheduleName] column (1 General Service, 1 Irrigation, 1 Large Commercial, 1 Large Commercial Load Control, and 1 Residential & Small Commercial).
When I make a table in my report with 'RateSchedule - Current[UtilityName] and my formula above, I get a count of 10 instead of 5.
 
I've tried changing the options in the "Visualizations" tab to Count, Distinct Count, Don't Summarize etc. and nothing yields the results I want.
 
Please let me know if more info is needed!
 
Thank you!

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rweb95 , Try measure as

calculate(DISTINCTCOUNT('RateSchedule - Current'[RateScheduleName]), filter('RateSchedule - Current', 'RateSchedule - Current'[IsActive] && 'RateSchedule - Current'[IsDefault]
&& isblank('RateSchedule - Current'[CompanyId])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Does this work?

=calculate(DISTINCTCOUNT('RateSchedule - Current'[RateScheduleName]), RateSchedule - Current'[IsActive]=TRUE(),'RateSchedule - Current'[IsDefault]=TRUE(),'RateSchedule - Current'[CompanyId]=BLANK())


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@rweb95 , Try measure as

calculate(DISTINCTCOUNT('RateSchedule - Current'[RateScheduleName]), filter('RateSchedule - Current', 'RateSchedule - Current'[IsActive] && 'RateSchedule - Current'[IsDefault]
&& isblank('RateSchedule - Current'[CompanyId])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Wonderful! It did work. Thank you for your help!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.