Forum Discussion
Dynamic measure based on selection slicer
hi,
I would need to create a dynamic title/measure.
The slicer selection is on monthyear column.
If Dec2021, is selected, the title is Dec2021.
If Feb2022 is selected, the title is Feb2022 and etc...
Help is appreciated
| id | index | year | month | monthyear |
| 20221 | 1 | 2022 | 1 | Dec 2021 |
| 20222 | 2 | 2022 | 2 | Jan 2022 |
| 20223 | 3 | 2022 | 3 | Feb 2022 |
| 20224 | 4 | 2022 | 4 | Mar 2022 |
| 20225 | 5 | 2022 | 5 | Apr 2022 |
| 20226 | 6 | 2022 | 6 | May 2022 |
| 20227 | 7 | 2022 | 7 | Jun 2022 |
| 20228 | 8 | 2022 | 8 | Jul 2022 |
| 20229 | 9 | 2022 | 9 | Aug 2022 |
| 202210 | 10 | 2022 | 10 | Sep 2022 |
| 202211 | 11 | 2022 | 11 | Oct 2022 |
| 202212 | 12 | 2022 | 12 | Nov 2022 |
| 20231 | 13 | 2023 | 1 | Dec 2022 |
| 20232 | 14 | 2023 | 2 | Jan 2023 |
Hi , Pallavi_m
According to your description, you want to "if jan 2022 is selected in the slicer, then measure has to return jan2022."
Here are the steps you can refer to :
(1)We can create a measure:
Measure = var _slicer_date=SELECTEDVALUE('Table'[monthyear]) return FORMAT(_slicer_date,"mmm yyyy")(3)Then we put the [monthyear] on the slicer visual and the measure on the card visual and we will meet your need :
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
3 Replies
- amitchandakSuper User
Pallavi_m , You can use Matrix and use Month Year on the column.
https://docs.microsoft.com/en-us/power-bi/visuals/desktop-matrix-visual
- Pallavi_mHelper I
Hi amitchandak . Thanks for the quick reply.Could you eloborate more.
Requirement: measure has to be created on the slicer selection.
Measure returns just the monthyear column value i.e., if jan 2022 is selected in the slicer, then measure has to return jan2022.
Hope I'm clear.
- v-yueyunzh-msftCommunity Support
Hi , Pallavi_m
According to your description, you want to "if jan 2022 is selected in the slicer, then measure has to return jan2022."
Here are the steps you can refer to :
(1)We can create a measure:
Measure = var _slicer_date=SELECTEDVALUE('Table'[monthyear]) return FORMAT(_slicer_date,"mmm yyyy")(3)Then we put the [monthyear] on the slicer visual and the measure on the card visual and we will meet your need :
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly