Forum Discussion

MarcusClaudius's avatar
MarcusClaudius
Regular Visitor
8 years ago

Manually defining a variable for use in a measure

To all

 

In my Excel reports I have what I call a 'control box'. This defines the date/period variables and it looks like this:-

 

 

The Green is what can be changed (by drop down menu).
The black is all calculated.

Though it, I can define the periods (both Month and YTD) in my subsequent report sheets.

The question is, can this be done in Power BI?

Have a (possibly hidden) sheet with which you can manually define variables for use in measures?

Ideally so once I've created my 'base measures' for a particular group of accounts. I can then have two, or maybe even three front line measures. Month, YTD, and Full Year. Ideal if you are dealing with Budget or Prior Year.

 

Thanks

 

Mark Taylor

4 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi MarcusClaudius,

     

    Actually it is not possbile to achieve the exact same result as you excepted. However we can create a table and a slicer to work around. Here is the sample for your reference.

     

    Here are the measures that I created in the sample file.

     

    LY Year Ending = YEAR(SELECTEDVALUE(dimtime[Date]))-1 &"/013"
    LY Year Opening = YEAR(SELECTEDVALUE(dimtime[Date]))-1&"/001"
    Month details = "31st"& FORMAT(SELECTEDVALUE(dimtime[Date]),"mmmmyyyy")
    Month name = FORMAT(SELECTEDVALUE(dimtime[Date]),"mmmm")
    Year Ending = YEAR(SELECTEDVALUE(dimtime[Date])) &"/013"
    Year Opening = YEAR(SELECTEDVALUE(dimtime[Date]))&"/001"

     

     

     

    For more details, please check the pbix as attached. And could you please tell me what is the logic of the Current Month?

     

    https://www.dropbox.com/s/a9x3frl7any6oth/Manually%20defining%20a%20variable%20for%20use%20in%20a%20measure.pbix?dl=0

     

    Regards,

    Frank

    • v-frfei-msft's avatar
      v-frfei-msft
      Icon for Community Support rankCommunity Support

      Hi MarcusClaudius,

       

      Does that make sense? If so, kindly mark my answer as a solution to close the case.

       

      Regards,

      Frank

      • MarcusClaudius's avatar
        MarcusClaudius
        Regular Visitor

        Apologies, my machine has been down this past week.

        IT said that Power BI corrupted it.

        I had to have the machine reimaged.

        And now I can finally get round to trying your solution out.

         

        Thanks for you help

         

        Mark