# Dax optimize measure

Hi,
in according to enterpise dna financial statement course i’ve set up a financial statement using the same tecnique.
The only add-in, is to have consider also some other values that can we sum. So to make this i’ve change a bit the base dax formula, with a parameter, so i can change the table which the dax formula take data from.

So i have 2 table, a base table “DatiCartella” and another table “DatiConRettifiche”.
The dax base formula is :
Ce Values =
VAR SCELTA = SELECTEDVALUE(‘Scelta Origine Dati’[Ordine di Scelta Origine Dati])
RETURN
switch(true(),
SCELTA = 0, [Ce Values 1], // contabile colonna Amount
SCELTA = 1, [Ce Values 2], // contabile con rettifiche
Calc[Ce Values 1]
)

The dax formula Ce value 1 and Ce values 2 are:
Ce Values 1 =
sum(DatiCartella[Amount])*-1

Ce Values 2 =
sum(DatiConRettifiche[Amount])*-1

So the only difference are the data file.

Why, when i try to change from teh selected value in the income statement, the dax formula need so too much time ?
If i changed in the filter from “Contabile” to “Contabile con rettifiche” , that change the table data, but it request a lot of time.