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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Counting unique values - formula adjustment

I have some tables set up like this: 

goodbecenergy_0-1708683086676.png

 

 

I need to see whether meter reads are being submitted on time. Linking _site to _meter to _reading was too much for my tiny brain to comprehend so I merged the queries via site id. 

 

This formula that I first thought was genius is now fast becoming the bane of my life:

b2c_site_active = CALCULATE(DISTINCTCOUNT('psa FIT_B2C_meter'[SiteID]),
('psa FIT_B2C_meter'[site.ContractTerminationDate] > now() || 'psa FIT_B2C_meter'[site.ContractTerminationDate] = BLANK()) &&
('psa FIT_B2C_meter'[site.ClosedDate] > now() ||'psa FIT_B2C_meter'[site.ClosedDate] = BLANK()),'psa FIT_B2C_meter'[b2c_meter_active] > 0)

 

The last filter about b2c meter >0 is a recent addition to try to solve the issue. 

 

It is doing what it says on the tin but it is placing a '1' in each occurence of the site (sites indeed have multiple active meters):

goodbecenergy_1-1708683285762.png

 

My end goal is to see what percentage of customers submit 1,2,3 or 4 times a year but the first step is getting some baseline numbers about number of active/inactive sites and meters. 

 

Thanks in advance.

1 REPLY 1
jolind1996
Resolver II
Resolver II

Does this work:

 

b2c_site_active = 
CALCULATE(
    DISTINCTCOUNT('psa FIT_B2C_meter'[SiteID]),
    ('psa FIT_B2C_meter'[site.ContractTerminationDate] > NOW() || ISBLANK('psa FIT_B2C_meter'[site.ContractTerminationDate])) &&
    ('psa FIT_B2C_meter'[site.ClosedDate] > NOW() || ISBLANK('psa FIT_B2C_meter'[site.ClosedDate])),
    'psa FIT_B2C_meter'[b2c_meter_active] > 0
)

 

Best regards,

Johannes 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.