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

Expected resultsExpected 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
Nathaniel_C
Super User
Super User

@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!




@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!




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

 

 

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.

@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!




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.