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
Anonymous
Not applicable

how to calculate total count and total by group

Hi,

I have integrated sharepoint list which has log entry and has following columns

 

S-NO
Created By
Company Name
Time In
Time Out

 

i want to calulate data like

 

Total records : 10
Company name have most entry : ABC Company
Created By have most entry : ABC Person


Please guide how can i calculate this.
Thx

1 ACCEPTED SOLUTION

Hi @Anonymous

Here is a modified pbix according to your dataset.

 

 

Best Regards

Maggie

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi

How do you define “Company name have most entry”?

 

The company name which has most counts of rows in the column “Company name”?

 2.png

 

Or, The company name which have the most time period between Time in and Time Out?

 3.png

 

If situation1, I create measures to achieve results below

 4.png

totalrecords = CALCULATE(COUNTROWS(Sheet1),ALL(Sheet1))

 

countpercompany = CALCULATE(COUNT(Sheet1[S-NO]),ALLEXCEPT(Sheet1,Sheet1[Company Name]))

rankofcount = RANKX(ALL(Sheet1),[countpercompany],,DESC)

Company name have most entry = IF([rankofcount]=1,[Company Name],BLANK())

 

countpercreatedby = CALCULATE(COUNT(Sheet1[S-NO]),ALLEXCEPT(Sheet1,Sheet1[Created By]))

rankofcount2 = RANKX(ALL(Sheet1),[countpercreatedby],,DESC)

created by have most entry = IF([rankofcount2]=1,MAX([Created By]),BLANK())

 

If situation2,

Create measures below to get Company name which has most entry

5.png

Measure1 = DATEDIFF(MAX([Time In]),MAX([Time Out]),MINUTE)

Measure2 = RANKX(ALL(Table1),[Measure1],,DESC)

Measure 3 = IF([Measure2]=1,MAX([Company Name]))

 

Best Regards

Maggie

Anonymous
Not applicable

thx for quires, but how i do it in Power Bi.

 

Anonymous
Not applicable

Hi,

now i got where to create measure. basically i want following result. pls guide which formula to use.

 

SNOCompany 
1ABC 
2RR 
3FF 
4ABC 
5RR 
6ABC 
7FA 
8XY 
9ABC 
10ABC 
   
OutPutCompany NameCount
1ABC5

thx

Hi @Anonymous

Here is a modified pbix according to your dataset.

 

 

Best Regards

Maggie

Anonymous
Not applicable

It show multiple entry for company where i want to show one entry with just count.

 

Thx

Hi @Anonymous

Here is my pbix.

 

Best Regards

Maggie

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.