Forum Discussion

iabarraganc's avatar
iabarraganc
Icon for Helper I rankHelper I
6 years ago

Calculatetable with dynamic calculated filter

Good morning everyone
I have a table where I store the following values

 

In addition, I have calculated a dynamic unique value, based on a table that already has data. I store this value in a measurement: 

mesSeleccionado = CALCULATE ( MIN ( V_DIM_TIEMPO[Id_Mes] ); ALLSELECTED ( V_DIM_TIEMPO ) ). As an example, you can return the value 201901.
What is needed is for a table to be calculated that returns the records that meet the required condition. For this case you should return the following:

Since the selected value is dynamic and chosen by the user, I thought that the table would be calculated by means of the following instruction in DAX:

-----------------------------------------------------------------------------

newTable =
VAR mesSeleccionado =
CALCULATE ( MIN ( V_DIM_TIEMPO[Id_Mes] ); ALLSELECTED ( V_DIM_TIEMPO ) )
return
CALCULATETABLE(TASAxPAIS;TASAxPAIS[Id_Mes]=mesSeleccionado)
-----------------------------------------------------------------------------
 
But in this case it always returns the first value of the Id_Mes field that the table has, and does not dynamically calculate what is required.

Please let me know how this situation could be resolved. Thanks for your help.

5 Replies

  • iabarraganc ,  New table will take the values at the time of creation. Post that they will not take.

     

    I am not sure of use case but you can have the table in memory in a measure. but that is only one measure

    • iabarraganc's avatar
      iabarraganc
      Icon for Helper I rankHelper I

      Thank you for your interest amitchandak . What happens is that a set of data is required to be returned (not a single value), since depending on the country and the id, calculations will be made towards the fact table. So a single value does not work for what you need to calculate. Any other idea?

  • Hello everyone

    After analyzing the different proposed alternatives, it was decided at the backend level of the database to leave the previous value and the current value in the same record. This way it was possible to simplify the use of DAX and increase the dashboard efficiency . The proposed solution alternatives were very useful to find a solution.

    Thank you very much for all your collaboration