cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## GroupBy and SUM

I am trying to group data and then summaraize said date and am having issues with the measures. An example of what I have:

Date: the transaction date

Check #: uniquie ID, but note that check numbers are reused daily. So we will have "Check 1" used on Monday; Check 2 on Tuesday, etc.

Price Sold: the cost of the good sold

Expected results

Measure 1: I need to Group the table by Date and provide the SUM of the products sold.

Measure 2: I need to group the table by the Date and procide the Distinct Count of the # of checks.

Thanks for any help.

5 REPLIES 5
Super User IV

## Re: GroupBy and SUM

`Count of Checks = COUNT('Table'[Check #])`

Will post pbix in a minute.

Using this measure, you can just drop columns on to matrix or table as I have done.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Proud to be a Super User!

Super User IV

## Re: GroupBy and SUM

Here is my file  PBIX.

My table is abbreviated from your sample.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Proud to be a Super User!

Frequent Visitor

## Re: GroupBy and SUM

Thanks, so this get's me the number of checks per day. Although, I did change the formula up to DISTINCTCOUNT, vs COUNT:

`NumberofChecks = DISTINCTCOUNT(Sales[Check_Number])`

The problem is the grand total. See below. This gives me the daily count for each day, but because check numbers are reused daily it does not properly count for the grand total of a month.

Super User IV

## Re: GroupBy and SUM

Not sure how the tables are set up, but see below or you may have to use FILTER.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

`NumberofChecks = CALCULATE(DISTINCTCOUNT(Sales[Check_Number], [DATE])`

Proud to be a Super User!

New Contributor

## Re: GroupBy and SUM

Hi @texasbiuser ,

This is a question about measure total, you can try the following measure:

```NumberofChecks =
SUMX (
VALUES ( Sales[Date] ),
CALCULATE ( DISTINCTCOUNT ( Sales[Check_Number] ) )
)```

For more details, the following posts may be helpful:

Dealing with Measure Totals

Measure Totals, The Final Word

Best Regards,

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

Announcements

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!