Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Daily Transactions Bypassing Dates

The goal is to calculate sales across all dates regardless if the sales occurred on that date or not. Currently, I am calculating sales that occurred on the date of the transaction (ex: "current_sales_output"). A new business requirement was added where sales are to be calculated over all dates (ex: "desired_sales_output"). Is there a way for me to calculate sales across all dates with the parameters not being before the date of the first sales transaction or beyond the date of the latest transaction? Below you will find the following: Current Sales Output Measure / Sample Data (with current output + desired output). 

 

Your advice is greatly appreciated. 

 

current_sales_output Measure

 

current_sales_output = SUM( Sales[Value] )

 

 

Sample Data (with current output + desired output)

datecurrent_sales_outputdesired_sales_output
Sunday, May 31, 202175
Monday, June 1, 202105
Tuesday, June 2, 202105
Wednesday, June 3, 2021145
Thursday, June 4, 202175
Friday, June 5, 202105
Saturday, June 6, 202175
TOTAL3535
  • Hi Anonymous ,

    IF you want to create a new coulumn to calculate output,use the following:

    out1 = SUM('Table'[current_sales_output])/COUNTROWS('Table')

    And if you want to create a measure to calculate it ,use the following :

    out2 = CALCULATE(SUM('Table'[current_sales_output])/COUNTROWS('Table'),ALL('Table'))

    Final output:

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      AlexisOlson I chose 5 for each non-total row because it was divisible by 7 (as in 7 days). I could have chosen a better number but the goal of my example was to show an example that would be simple and easy to understand. Apologies if it is confusing. 

      • AlexisOlson's avatar
        AlexisOlson
        Icon for Super User rankSuper User

        I'm asking what it represents since 5 is clearly not the total across all dates that you are asking for in your original post but rather the total distributed equally across the dates (which you never mentioned as far as I can tell).

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    IF you want to create a new coulumn to calculate output,use the following:

    out1 = SUM('Table'[current_sales_output])/COUNTROWS('Table')

    And if you want to create a measure to calculate it ,use the following :

    out2 = CALCULATE(SUM('Table'[current_sales_output])/COUNTROWS('Table'),ALL('Table'))

    Final output:

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien