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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Pzin
New Member

Help a starter - Counting Probelm

Hello Pros:),

 

i just started with PowerBI i have my fair share of Failure during the last month. There is one result i would like to achieve which just won't work...

I m gonna break it down to this:

Customer      Date                  Case 
A                 01.01.2023          1

A                 01.01.2023          1

B                 01.02.2023          1

B                 01.01.2023          1


What i want to do is, i wanna know how many days we were at a customer. (Per Customer and in Total)
We visited A twice at one day = 1 Day. 
We vistited B twice but on different days = 2 Days

That's working fine with a DistinctCount function for Date. BUT if i want to have the Total of all days at all customer i will get 2 (01.01.2023 and 01.02.2023) as a result. What i want to have is 3. 

Hope someone will help me with this little WarmUp:)

Greez
Pascale

1 ACCEPTED SOLUTION
ahmedoye
Responsive Resident
Responsive Resident

Try the approach below. If it works for you, kindly mark this as a solution so anyone with similar issues can easily find it.

Measure =
SUMX(
         ALL(CustomersData[Customer]),
                CALCULATE(
                                    DISTINCTCOUNT(CustomersData[Date])
                                 )
                                 )

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Write these measures

Visit days_Inter = DISTINCTCOUNT(Data[Date])
Visit days = SUMX(VALUES(Data[Customer]),[Visit days_Inter])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-zhangti
Community Support
Community Support

Hi, @Pzin 

 

You can try the following methods.

Measure =
VAR _table =
    SUMMARIZE ('Table', 'Table'[Customer],
        "Count",
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[Date] ),
                ALLEXCEPT ( 'Table', 'Table'[Customer] )
            )
    )
RETURN
    SUMX ( _table, [Count] )

vzhangti_0-1681179542671.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ahmedoye
Responsive Resident
Responsive Resident

Try the approach below. If it works for you, kindly mark this as a solution so anyone with similar issues can easily find it.

Measure =
SUMX(
         ALL(CustomersData[Customer]),
                CALCULATE(
                                    DISTINCTCOUNT(CustomersData[Date])
                                 )
                                 )

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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