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
mhesli
New Member

Calcuating how many times you cleaned the pool clean and grass cut for the same customer

I want to see how many accounts get both pool clean and grass cut on the same day. I need a calculation to use. I have tried

CALC Pool Clean and Grass Cut Same day= CALCULATE(
DISTINCTCOUNT(Customer[Account]),
Customer[Pool Clean] = 1,
Customer[Grass Cut] = 1
)

And it does not work. Any help would be greatly appreciated!

 

Date AccountServicePool CleanGrass Cut
5/1/20255143Pool Clean1 
5/1/20255143Grass Cut 1
5/1/20255143Water lawn  
5/1/20255144Water lawn  
5/1/20255144Walk dog  
5/1/20255144Fertalize  
5/1/20255145Pool Clean1 
5/1/20255145Grass Cut 1
5/1/20255145Water lawn  
5/1/20255145Walk dog  
5/1/20255145Fertalize  
5/1/20255146Water lawn  
5/1/20255146Walk dog  
5/1/20255146Fertalize  
5/8/20255147Pool Clean1 
5/8/20255147Grass Cut 1
5/8/20255148Water lawn  
5/8/20255148Walk dog  
5/8/20255148Fertalize  
5/8/20255149Pool Clean1 
5/8/20255149Grass Cut 1
5/8/20255149Water lawn  
5/8/20255150Walk dog  
5/8/20255150Fertalize  
5/8/20255151Pool Clean1 
5/8/20255151Grass Cut 1
5/8/20255151Walk dog  
5/8/20255151Fertalize  
5/13/20255152Pool Clean1 
5/13/20255152Grass Cut 1
5/13/20255152Water lawn  
5/13/20255153Walk dog  
5/13/20255153Fertalize  
5/13/20255154Pool Clean1 
5/13/20255154Grass Cut 1
5/13/20255154Fertalize  
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @mhesli 

Here are a couple of options. I would probably prefer the first one:

CALC Pool Clean and Grass Cut Same day = 
VAR AccountDate =
    FILTER (
        SUMMARIZE ( Customer, Customer[Account], Customer[Date] ),
        VAR Pool = CALCULATE ( SUM ( Customer[Pool Clean] ) )
        VAR Grass = CALCULATE ( SUM ( Customer[Grass Cut] ) )
        RETURN
            AND ( Grass, Pool )
    )
VAR Result =
    COUNTROWS ( GROUPBY ( AccountDate, Customer[Account] ) )
RETURN
    Result
CALC Pool Clean and Grass Cut Same day = 
VAR AccountDatePool =
    CALCULATETABLE (
        SUMMARIZE ( Customer, Customer[Date], Customer[Account] ),
        KEEPFILTERS ( Customer[Pool Clean] = 1 )
    )
VAR AccountDateGrass =
    CALCULATETABLE (
        SUMMARIZE ( Customer, Customer[Date], Customer[Account] ),
        KEEPFILTERS ( Customer[Grass Cut] = 1 )
    )
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( Customer[Account] ),
        AccountDatePool,
        AccountDateGrass
    )
RETURN
    Result

Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

5 REPLIES 5
v-shamiliv
Community Support
Community Support

Hi @mhesli 
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

v-shamiliv
Community Support
Community Support

Hi @mhesli 
I wanted to check if you had the opportunity to review the information provided by @maruthisp  and @OwenAuger . Please feel free to contact us if you have any further questions. If their response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-shamiliv
Community Support
Community Support

Hi @mhesli 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

maruthisp
Solution Specialist
Solution Specialist

Hi mhesli,

As per my understanding - Count unique combinations of  Account and Date where both services happened.
Below is the DAX expression:

PoolCleanAndGrassCutSameDay =
COUNTROWS(
FILTER(
SUMMARIZE(
CustomerServices,
CustomerServices[Date],
CustomerServices[Account],
"HasPoolClean", CALCULATE(COUNTROWS(CustomerServices), CustomerServices[Service] = "Pool Clean"),
"HasGrassCut", CALCULATE(COUNTROWS(CustomerServices), CustomerServices[Service] = "Grass Cut")
),
[HasPoolClean] > 0 && [HasGrassCut] > 0
)
)

Please let me know if this helps or need any more modifications. 
Thanks in advance.
Best Regards,

Maruthi
LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/
X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

OwenAuger
Super User
Super User

Hi @mhesli 

Here are a couple of options. I would probably prefer the first one:

CALC Pool Clean and Grass Cut Same day = 
VAR AccountDate =
    FILTER (
        SUMMARIZE ( Customer, Customer[Account], Customer[Date] ),
        VAR Pool = CALCULATE ( SUM ( Customer[Pool Clean] ) )
        VAR Grass = CALCULATE ( SUM ( Customer[Grass Cut] ) )
        RETURN
            AND ( Grass, Pool )
    )
VAR Result =
    COUNTROWS ( GROUPBY ( AccountDate, Customer[Account] ) )
RETURN
    Result
CALC Pool Clean and Grass Cut Same day = 
VAR AccountDatePool =
    CALCULATETABLE (
        SUMMARIZE ( Customer, Customer[Date], Customer[Account] ),
        KEEPFILTERS ( Customer[Pool Clean] = 1 )
    )
VAR AccountDateGrass =
    CALCULATETABLE (
        SUMMARIZE ( Customer, Customer[Date], Customer[Account] ),
        KEEPFILTERS ( Customer[Grass Cut] = 1 )
    )
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( Customer[Account] ),
        AccountDatePool,
        AccountDateGrass
    )
RETURN
    Result

Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.