Forum Discussion

Pallavi_m's avatar
Pallavi_m
Helper I
3 years ago
Solved

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

 

 

 

idindexyearmonthmonthyear
20221120221

Dec 2021

20222220222Jan 2022
20223320223Feb 2022
20224420224Mar 2022
20225520225Apr 2022
20226620226May 2022
20227720227Jun 2022
20228820228Jul 2022
20229920229Aug 2022
20221010202210Sep 2022
20221111202211Oct 2022
20221212202212Nov 2022
202311320231Dec 2022
202321420232Jan 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

    • Pallavi_m's avatar
      Pallavi_m
      Helper 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-msft's avatar
        v-yueyunzh-msft
        Community 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