cancel
Showing results for
Did you mean:
Frequent Visitor

## datediff of childs row in table with parent row table

Hi. i have a problem. i'm new on power BI

i have a table that contains childs and parent rows, and in other table i have only the child rows every row of both tables have start date and end date. i have to calculate total diff time of parent row and child rows. i have the following DAX expression:

tiempoResolucion = DATEDIFF(incidencias[fecha_inicio];incidencias[fecha_fin]; MINUTE) + CALCULATE(
SUMX(
incidenciasHijas;
DATEDIFF(incidenciasHijas[fecha_inicio];incidenciasHijas[fecha_fin]; MINUTE)
),

it returns me the following error:

A circular dependency was detected: incidencias[tiempoResolucion], incidenciasHijas[fecha_fin], incidenciasHijas[incidenciasHijas-5d28653b-e27d-4379-bc24-c4258834cb23], incidencias[tiempoResolucion].

somebody can tell me how can i solve this and why this error?

thanks

4 REPLIES 4
Super Contributor

## Re: datediff of childs row in table with parent row table

Hi @maxpower,

Could you try the formula below to see if it works in your scenario?

```tiempoResolucion =
DATEDIFF ( incidencias[fecha_inicio]; incidencias[fecha_fin]; MINUTE )
+ IF (
SUMX (
incidenciasHijas;
DATEDIFF ( incidenciasHijas[fecha_inicio]; incidenciasHijas[fecha_fin]; MINUTE )
)
)
```

Regards

Frequent Visitor

## Re: datediff of childs row in table with parent row table

thanks for response but the expression not works. it continues showing the same error "A circular dependency was detected: incidencias[tiempoResolucion], incidenciasHijas[fecha_fin], incidenciasHijas[incidenciasHijas-5d28653b-e27d-4379-bc24-c4258834cb23], incidencias[tiempoResolucion]."

i don't know if is important but the table that contains child rows can contains 1 or more rows to the same parent row ( 1 - * )

Super Contributor

## Re: datediff of childs row in table with parent row table

Hi @maxpower,

Could you post your table structures(including the relationships) with some sample/mock data which can help us reproduce this issue, so that we can better assist on it? It's even better to share a sample pbix file(with just some mock data) which can reproduce the issue. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading

Regards

Frequent Visitor

## Re: datediff of childs row in table with parent row table

it's not possible. sorry

i tell you my steps i hope it helps to get the error.

i import a mysql table "incidencias" wich is relationed with other tables.

i create in modeling view a table called "incidenciasHijas"  incidenciasHijas = FILTER(incidencias;incidencias[id_padre] <> BLANK() )

in table incidencias i create a new column called "tiempoResolucion" with the formula described in the previous post.

i see now that when i create the new column (tiempoResolucion) automatically it's created the same column in the table "incidenciasHijas" why is the reason? i would to create table with other method??

thanks

Announcements

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 302 members 3,086 guests
Recent signins: