Forum Discussion

flownfluid's avatar
flownfluid
Frequent Visitor
5 years ago

Refresh column in a table

Hi all,

I don't know if I'm on the right way but maybe you can give me some advices... 

 

I have two identical tables (Tab1 and Tab2 like):

IDDateText
125.07.2021Text_1
225.07.2021Text_2
126.07.2021Text_NewId_1
226.07.2021Text_2

 

I want to show up the Text difference between two dates. I created two slicer (Dropdown) to select a Date from Tab1 and the other from Tab2. I have also created for each a measure to figure out the selected date like:

 

SelectedDate = SELECTEDVALUE(Tab1[Date],MIN(Tab1[Date])

 

 

I added a column in Tab2 with the following:

 

TextFromTab1 = LOOKUPVALUE(Tab1[Text],Tab1[Date],SelectedDate,Tab1[ID],Tab2[ID])

 

 

The formel above is working, but when I change the Date in the slicer, the values in the column are not updated...

Can I refresh the column when the slicer is changed or do I need to create for this kind of problem a measure?

 

If I need to go over measure, can you make me an example?

 

Thank you for your help/support

 

 

 

3 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey flownfluid ,

     

    calculated columns are always static. When the data model is loaded, the values of the column are created. Then they won't change anymore, for example when you change a slicer. 

     

    So this approach won't work. But you can try to modify that column into a measure as measures are dynamic and change with every change of a filter.

    Depending on your data LOOKUPVALUE might not work if there are multiple values, but it could also work as a measure.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
    • flownfluid's avatar
      flownfluid
      Frequent Visitor

      Hey Selimovd,

       

      thank you for your explenation.

       

      I created the following measure:

      TextFromList1 = 
          VAR l_SelectDateTab1= SELECTEDVALUE(Tab1[Date],MIN(Tab1[Date]))
      RETURN
          LOOKUPVALUE(
              Tab1[Text],
              Tab1[Date],
              l_SelectDateTab1,
              Tab1[ID],
              FIRSTNONBLANK(Tab2[ID],1)
              )

      It looks like that this measure works and shows me also the right text.

       

      But when I create the next measure with a simple if, then something goes wrong:

      MatchText = 
          var TextList2 = FIRSTNONBLANK(Tab2[Text],1)
          RETURN
          IF(TextList2 = [TextFromList1],1,0)

       

      Can you explain me, what is wrong or why it is not working?

       

      General: The ID is unique for a specific day

       

      Thank you for your help