cancel
Showing results for
Search instead for
Did you mean:
Highlighted
Helper II

## 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

Accepted Solutions
Highlighted
Community Support

## Re: how to calculate total count and total by group

Hi @imughal

Here is a modified pbix according to your dataset.

Best Regards

Maggie

6 REPLIES 6
Highlighted
Community Support

## Re: how to calculate total count and total by group

Hi

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

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

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

If situation1, I create measures to achieve results below

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

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

Highlighted
Helper II

## Re: how to calculate total count and total by group

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

Highlighted
Community Support

Hi @imughal

Here is my pbix.

Best Regards

Maggie

Highlighted
Helper II

## Re: how to calculate total count and total by group

Hi,

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

 SNO Company 1 ABC 2 RR 3 FF 4 ABC 5 RR 6 ABC 7 FA 8 XY 9 ABC 10 ABC OutPut Company Name Count 1 ABC 5

thx

Highlighted
Helper II

## Re: how to calculate total count and total by group

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

Thx

Highlighted
Community Support

## Re: how to calculate total count and total by group

Hi @imughal

Here is a modified pbix according to your dataset.

Best Regards

Maggie

## Helpful resources

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

#### Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors