cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
texasbiuser Frequent Visitor
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

 

1.PNG

2 - Copy.PNGExpected 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
Super User IV

Re: GroupBy and SUM

@texasbiuser 

 

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.

 

 

 

 

group3.PNG

 

group2.PNG

 

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Super User IV
Super User IV

Re: GroupBy and SUM

@texasbiuser ,

 

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 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




texasbiuser Frequent Visitor
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.

 

Capture.PNG

 

 

Super User IV
Super User IV

Re: GroupBy and SUM

@texasbiuser ,

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])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




v-joesh-msft New Contributor
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.

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

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?

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

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!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors