March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I have request where I need the user to review sales numbers each month from 1st month till selected month.
I managed to do this usind below measure
Sales up to selected month =
CALCULATE (
[Sum Of Sales],
FILTER(
dim_date,
MAX ( dim_date[Date]) <= MAX ( DisconnectedDate[Date] )
)
)
This works well with data for one year only, and if I add another year it simply sums the sales numbers for each month. I want the user to select a year from a slicer and then review sales that year per month.
Relations is a below:
Your assistance is much appreciated - thanks!
Solved! Go to Solution.
@Anonymous , You do not want to show a trend YTD can work with date table and time intelligence
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
In case you want show trend you need independent date table in slicer
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max,-1*MONTH(_max))+1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
@Anonymous , You do not want to show a trend YTD can work with date table and time intelligence
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
In case you want show trend you need independent date table in slicer
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max,-1*MONTH(_max))+1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Hi @amitchandak,
Thanks a million for your reply. Which was much helpfull.
I manged to solve the puzzle with below measure as you suggested:
Sales YTD upto selected month =
var _max = maxx(ALLSELECTED(DisconnectedDate),DisconnectedDate[Date])
var _min = eomonth(_max,-1*MONTH(_max))+1
return
Calculate([Sum Of Sales], Filter(dim_date,dim_date[Date] <= _max && dim_date[Date] >=_min))
Tables are now filtering as requested! Perfect 🙂
Thanks once again!
User | Count |
---|---|
120 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |