Forum Discussion

texasbiuser's avatar
texasbiuser
Frequent Visitor
6 years ago

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

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion

    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.

     

     

     

     

     

     

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

    • Nathaniel_C's avatar
      Nathaniel_C
      Icon for Community Champion rankCommunity Champion

      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 

      • texasbiuser's avatar
        texasbiuser
        Frequent Visitor

        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.