Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I am hoping there is a guru on here who will enlighten me as I am hitting a wall on what I thought would be straight forward.
I am creating a sales dashboard and want the main page to be dynamic base don the date selected in a slicer e.g:
YTD: Results for the year up to the date selected
MTD: Results for the month of the data selected i.e. if a user selected 1/10/20 June 2024, the month is June 2024
DAY: Results for the day selected
YTD and MTD are proving tricky. I can calcuate them individually no problem but it is the "making them dynamic part" that is confusing me.
I was hoping to achieve this with the "SELECTEDVALUE" function to return a specific column from my calendar table which I would then use in my measure, but it is the bold and underlined part that is completely stumping me.
In my calendar table, I have a column called "MonthYearNum" which is simply the year and the month number so June 2023 is 202306. This is the column I want returned based on the user selection in the date slicer.
I was then hoping to use that value in a revenue measure along the lines of:
Solved! Go to Solution.
Hi @JS_UNI4C ,
For combining dynamic metrics with slicers, try the following formula:
SelectedMeasureType = SELECTEDVALUE('MeasureType'[Measure], "YTD")
Dynamic Revenue =
SWITCH(
[SelectedMeasureType],
"YTD", [Revenue YTD],
"MTD", [Revenue MTD],
"DAY", [Revenue DAY]
)
Revenue DAY =
CALCULATE(
[SalesSum],
FILTER(
'Calendar',
'Calendar'[Date] = SELECTEDVALUE('Calendar'[Date])
)
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @JS_UNI4C ,
For combining dynamic metrics with slicers, try the following formula:
SelectedMeasureType = SELECTEDVALUE('MeasureType'[Measure], "YTD")
Dynamic Revenue =
SWITCH(
[SelectedMeasureType],
"YTD", [Revenue YTD],
"MTD", [Revenue MTD],
"DAY", [Revenue DAY]
)
Revenue DAY =
CALCULATE(
[SalesSum],
FILTER(
'Calendar',
'Calendar'[Date] = SELECTEDVALUE('Calendar'[Date])
)
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Many thanks for the response and sorry for the lack of response on my part. Been a crazy few days but it is back to Power BI now so I will be giving this a go today! Hoping it works...!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |