Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have sales value column and sales date. I would like to calculate the total value of sales from the earliest sales date until the previous month of the current month regardless its year and month. Example, if the earliest sales date is January 2020 and current date is August 2022, I would like to calculate total sales from January 2020 to July 2022.
Appreciate your help.
Thank you!
Solved! Go to Solution.
Hi, @Anonymous ;
You could try it.
measure =
CALCULATE (
SUM ( [sales] ),
FILTER (
ALL ( 'table' ),
[category] = "chicken"
&& [date] <= EOMONTH ( TODAY (), -1 )
)
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
You could try it.
measure =
CALCULATE (
SUM ( [sales] ),
FILTER (
ALL ( 'table' ),
[category] = "chicken"
&& [date] <= EOMONTH ( TODAY (), -1 )
)
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I am not sure how your expected outcome looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can help to provide some ideas on how to create a solution for your dataset.
Sales until previous month: =
CALCULATE (
[Sales measure:],
KEEPFILTERS ( Dates[Date] <= EOMONTH ( TODAY (), -1 ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
how can i do if I want to add another filter along with keepfilters. example calculate(sum(sales), filter('table'[category] = "chicken"))
Hi,
Thank you for your message, and please share your pbix file's link here, and then I can try to look into it to come up with an accurate solution for your dataset.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
@Anonymous , Try like
LTD =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),-1)
var _min = Minx(ALLSELECTED('Date'),'Date'[Date])
return
CALCULATE([net] ,filter('Date', 'Date'[Date]>=_min && 'Date'[Date] <=_max))
LTD =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),-1)
var _min = Minx(ALLSELECTED('Date'),'Date'[Date])
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
83 | |
75 | |
64 | |
39 | |
34 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |