Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
rphang
Frequent Visitor

Average Gross Amount (TODAY instead of full month)

I would need help for below I can't seems to get around the correct formula to use. Basically I am trying to achieve 2 results,

 

  1. To show an average Gross Amount per day (excluding TODAY)

E.g if today is 17 Nov, I should have total Gross Amount (till 16th Nov) divided by 16 days (01 - 16 Nov).

120,346.50 / 16 = 7,521.66

 

Right now with my DAX, it is taking current Total Gross Amount per month divided by total days in the month. Therefore I am getting 4,011.55 instead of 7,521.66.

 

Avg MTD Sales = CALCULATE(SUM('Table1'[Gross_Amount__c]), DATESMTD('DateDIM'[Date])) / CALCULATE(COUNT('DateDIM'[Date]),DATESMTD('DateDIM'[Date]))

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @rphang 

According to your description and sample data, I can roughly understand your requirement, you can try this method to achieve this:

Create two calculated columns like this:

Till Date Total Sales =

CALCULATE(SUM('Table'[Sales Amount]),FILTER(ALL('Table'),MONTH([Date])=MONTH(EARLIER('Table'[Date]))&&[Date]<=EARLIER('Table'[Date])))
Till Date Avg Daily Sales =

var _monthend=EOMONTH(MAX('Table'[Date]),0)

var _monthstart=DATE(YEAR(_monthend),MONTH(_monthend),1)

var _datediff=MAX('Table'[Date])-_monthstart

return

DIVIDE([Till Date Total Sales],_datediff)

 

Create a measure:

Flag =

IF(MAX('Table'[Date])<=TODAY(),1,0)

 

Then you can create a line chart and place the columns then apply a visual filter like this:

vrobertqmsft_0-1637829582533.png

 

And you can get what you want.

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

View solution in original post

5 REPLIES 5
v-robertq-msft
Community Support
Community Support

Hi, @rphang 

According to your description and sample data, I can roughly understand your requirement, you can try this method to achieve this:

Create two calculated columns like this:

Till Date Total Sales =

CALCULATE(SUM('Table'[Sales Amount]),FILTER(ALL('Table'),MONTH([Date])=MONTH(EARLIER('Table'[Date]))&&[Date]<=EARLIER('Table'[Date])))
Till Date Avg Daily Sales =

var _monthend=EOMONTH(MAX('Table'[Date]),0)

var _monthstart=DATE(YEAR(_monthend),MONTH(_monthend),1)

var _datediff=MAX('Table'[Date])-_monthstart

return

DIVIDE([Till Date Total Sales],_datediff)

 

Create a measure:

Flag =

IF(MAX('Table'[Date])<=TODAY(),1,0)

 

Then you can create a line chart and place the columns then apply a visual filter like this:

vrobertqmsft_0-1637829582533.png

 

And you can get what you want.

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

@v-robertq-msft 

 

Exactly what I am looking for, thanks!!

v-robertq-msft
Community Support
Community Support

Hi, @rphang 

According to your description, I can clearly understand your requirement, I think you can try this measure:

This is the test data I created based on your description:

vrobertqmsft_0-1637574962053.png

Avg MTD Sales =

var _monthend=EOMONTH(MAX('Table'[Date]),0)

var _monthstart=DATE(YEAR(_monthend),MONTH(_monthend),1)

var _datediff=MAX('Table'[Date])-_monthstart

var _sum=CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Date]))

return

DIVIDE(_sum,_datediff)

 

And you can create a table chart and place it like this to get what you want, like this:

vrobertqmsft_1-1637574962059.png

 

You can download my test pbix file below

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

@v-robertq-msft 

 

Thank you for the formula.

 

Not sure if below table would help to elaborate. The formula will need to,

- calculate the month daily average (Total Sales Till Date divided by the days passed Till Date)

- identify "TODAY()" and stop the calculation from further calculation

- the results will need to be display on a line chart visual as well 🙂

 

DateSales AmountTill Date Total SalesTill Date Avg Daily SalesRemark
1-Nov-21876876876 / 1 
2-Nov-212341,1101110 / 2 
3-Nov-217651,8751875 / 3 
4-Nov-212342,1092109 / 4 
5-Nov-21762,1852185 / 5 
6-Nov-21232,2082208 / 6 
7-Nov-218763,0843084 / 7 
8-Nov-214,3637,4477447 / 8 
9-Nov-215477,9947994 / 9 
10-Nov-217,69615,69015690 / 10 
11-Nov-2119515,88515885 / 11 
12-Nov-211,29517,18017180 / 12 
13-Nov-21325 17,50517505 / 13 
14-Nov-212,35719,86219862 / 14 
15-Nov-2123420,09620096 / 15 
16-Nov-2154720,64320643 / 16 
17-Nov-211420,65720657 / 17 
18-Nov-216,82327,48027480 / 18 
19-Nov-2143227,91227912 / 19 
20-Nov-214,36332,27532275 / 20 
21-Nov-2112432,39932399 / 21 
22-Nov-2145732,85632856 / 22 
23-Nov-2112432,98032980 / 23 
24-Nov-214,51237,49237492 / 24 
25-Nov-21 37,4920< Today
26-Nov-21 37,4920 
27-Nov-21 37,4920 
28-Nov-21 37,4920 

 

Thank you!

Gabriel_Walkman
Continued Contributor
Continued Contributor

Maybe something like this would work. That is, if you are using months as the x-axis.
 
Daily average =
calculate(
    divide( sum('Table1'[Gross_Amount__c]), distinctcount( 'Table1'[Date] ) ),
    'Table1'[Date] <> today()
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.