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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
saranp780
Helper III
Helper III

How to count in the table (with conditions)

I'm trying to get counting the username and the date which is related. I have a table below

 

Date                        Username                    Computer Name

1/10/2017               ACT001                         Manage of Accounting Dep.

1/10/2017               ACT001                         Manage of Accounting Dep.

1/10/2017               ACT001                         Director of Acc.

2/10/2017               ACT001                         Manage of Accounting Dep.

2/10/2017               ACT001                         Manage of Accounting Dep.

2/10/2017               ACT002                         ACC. Staff02

2/10/2017               ACT002                         ACC. Staff002-TH

2/10/2017               ACT002                         ACC. Staff002-TH

3/10.2017               ACT001                         Manage of Accounting Dep.

3/10/2017              ACT003                         ACC> Staff03

4/10/2017              ACT002                         ACC. Staff002-TH

4/10/2017              ACT002                         ACC. Staff002-TH

 

Now I want to count by condition: if the same user on the same date then just count only one time.

Such as ACT001 = 3 days (How many days user used?)

             ACT002 = 2 days

             ACT003 = 1 day

 

Anyone who knows? please explain me how is the formula?

 

Thanks.

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @saranp780,

 

In addition, you should also be able to simply use the formula below to create a single measure to get the count in your scenario. Smiley Happy

Measure =
SUMX (
    SUMMARIZE ( Table1, Table1[Username], "abc", DISTINCTCOUNT ( Table1[Date] ) ),
    [abc]
)

r4.PNG

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @saranp780,

 

In addition, you should also be able to simply use the formula below to create a single measure to get the count in your scenario. Smiley Happy

Measure =
SUMX (
    SUMMARIZE ( Table1, Table1[Username], "abc", DISTINCTCOUNT ( Table1[Date] ) ),
    [abc]
)

r4.PNG

 

Regards

dilumd
Solution Supplier
Solution Supplier

Hi @saranp780


First create a calculated column to combine your date column and the user name column.

 

Date and Text = CountRawsFile[Date     ] & CountRawsFile[Username]

 

Then create the below measure to calculate the no of users.

 

NO of Raws = CALCULATE(DISTINCTCOUNT(CountRawsFile[Date and Text]),ALLEXCEPT(CountRawsFile,CountRawsFile[Username]))

 

help.JPG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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