Forum Discussion

shyamji's avatar
shyamji
Helper I
6 years ago
Solved

Unable to use selectedvalue

Hi,

i am creating a filter table based on selected year of dimension table , but table is not returning any row for selected year. If i use static value of selected year i.e. 2019 then table returns rows so please help why dynamic year is not working.

Below is my code

FilterTable = VAR SELECTED = SELECTEDVALUE('Date'[Year]) RETURN FILTER(
UserDetails,
YEAR(UserDetails[ActionDate]) = SELECTED
)

 

  • Hi shyamji ,

     

    We cannot create dymanic calculated column in power bi. I suggest your to create relationship between table based on year columns and use table visual to work around.

     

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Not 100% clear on this. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

     

    But, if you are trying to create an actual table in the model based upon a slicer selection that is simply not possible. Tables in the data model are calculated at refresh, they are not dynamic based upon dynamic user interaction. You can use a measure that includes a table VAR and that can be dynamic within the measure calculation. 

     

    Bottom line, I'm not clear on what you are asking.

    • shyamji's avatar
      shyamji
      Helper I
      Hi,
      would you like to explain how can we store  a table in measure? Measure can store a single value.My requirement is to store filtered column values from a table in to another table.
      Thanks
      Shyamji
  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi shyamji ,

     

    We cannot create dymanic calculated column in power bi. I suggest your to create relationship between table based on year columns and use table visual to work around.