Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi PBI Community,
I'm stuck with the following issue.
In my report, year and month are selected by using two slicers.
Based on this selection, a graph with YTD values up to the selected month should be displayed - including all previous months from the beginning of the year.
So I need a measure which calculates the YTD values over the month up to the end of the selected month.
Thanks for your help in advance!
Best,
An
Solved! Go to Solution.
@ab_99 , You need to use the disconnected table in the slicer.
//Date1 is independent/disconnected Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -1*month(_max) )
return
calculate( totalmtd(sum(Table[Value]),'Date'[Date]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
//Date1 is independent/disconnected Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -1*month(_max) )
return
if(Max('Date'[Date]) >=_min && ('Date'[Date]) <=_max, calculate( sum(Table[Value]),datesmtd('Date'[Date])) )
Hi @ab_99 ,
Attached is the demo file, and hope this helps you understand @amitchandak 's approach.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
@mh2587 thank you for your response! Sadly, its giving this result (as the month slicer is filtering the visual):
I need the privious months to be displayed too...
@ab_99 , You need to use the disconnected table in the slicer.
//Date1 is independent/disconnected Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -1*month(_max) )
return
calculate( totalmtd(sum(Table[Value]),'Date'[Date]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
//Date1 is independent/disconnected Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -1*month(_max) )
return
if(Max('Date'[Date]) >=_min && ('Date'[Date]) <=_max, calculate( sum(Table[Value]),datesmtd('Date'[Date])) )
@amitchandak Thank you for the help!
Unfortunately, your solution doesn't work - or maybe I got something wrong. Could you please add some more details to your solution?
Hi @ab_99 ,
Attached is the demo file, and hope this helps you understand @amitchandak 's approach.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
hi,
Thank you for your demo. It was usefull for me and I solved the problem!! 🙂
YTD Value = //This might give an idea
VAR SelectedYear = SELECTEDVALUE('Date'[Year])
VAR SelectedMonth = SELECTEDVALUE('Date'[MonthNumber])
RETURN
CALCULATE(
SUM('YourTable'[Value]),
FILTER(
ALL('Date'),
'Date'[Year] = SelectedYear &&
'Date'[MonthNumber] <= SelectedMonth
)
)
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
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 |
---|---|
80 | |
79 | |
60 | |
36 | |
33 |
User | Count |
---|---|
91 | |
59 | |
59 | |
49 | |
42 |