Forum Discussion

bernardoamaral's avatar
bernardoamaral
Frequent Visitor
6 years ago

Dynamic columns with filters

Hello everyone.

 

I have the following dilema. Supose we have the age of 3 people (A with 8 years, B with 9 years and C with 10 years) in 2020. I have a filter that selects a year from 2020 until 2040. Is there any way to get the age of the people from the filter?

 

For example:

 

2020            2040

8                  28

9                  29

10                30

 

Thank you

7 Replies

  • bernardoamaral may be try something like this

     

    Age in the future year = 
    VAR __numberofYears = MAX ( Table[Year] ) - MIN ( Table[Year] ) 
    RETURN MAX ( Table[Age] ) + __numberofYears 

     

    you can tweak above measure based on your model. 

    • bernardoamaral's avatar
      bernardoamaral
      Frequent Visitor

      parry2k thank you for the response, but that is not what I'm looking for.

       

      That works for the year 2040, but I want something dynamic. What I mean by that is that, with a filter, the user selects the year he wants. If, for example, the user selects 2040, it should appear:

       

       

      But if he selects 2030 it should appear

       

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

    Hi bernardoamaral ,

     

    We cannot create dynamic calculated column in power bi. You can create measure and add it to visuals to work around.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi bernardoamaral 

     

    I'm not sure if you got the solution or not, But if your are not, Follow these steps :

     

    Make a MEASURE 

     

    Age in the future year = 
    VAR __numberofYears = MAX ( Table[Year] ) - MIN ( Table[Year] ) 
    RETURN MAX ( Table[Age] ) + __numberofYears 

     

    NOTE :PLEASE DO NOT MAKE NEW COLUMN

     

    Regards,

    Gaurav Raj Singh