# Dax Tips and Tricks: Divide vs Divide

An interesting function on DAX si DiVIDE.

Un interessante funzione che pochi conoscono e sfruttano in DAX è DIVIDE. It often happens that when you create a measure in dax , especially if you take advantage of the time intelligence you want to create delta and Delta % Measure.

Normally a person would write , to make a Delta % vs PY CY , the following formula :

Delta % CY vs PY := ([AMount CY] -[Amount PY]) / [Amount PY]

What usually happens is the abscence of py data, dax not handle in automatic a value divide by zero  and this is what happen: A simple solution can be use the if statement:

if(isblank([amount py]);0;formula).

This Formula is very inefficient for you and for the model, you have to use this:

Delta % CY vs PY:=divide([AMount CY] -[Amount PY];[Amount PY];0)

In automatic way Dax control if it’s possible to do the division, if isn’t possible then:

• insert blank value if i don’t insert nothing in the formula
• Insert specific value ( in our example the zero value)