Issue with template expression

Hi I was wondering if someone could help me verify this template expression? I can’t get it to return anything. The exact same expression return values in the editor. I can’t figure out what I am missing

<<Start: [Related Job Activities]>>
<<TOTALHOURS(SUM(SELECT(Job Activity[Duration],[Production Id]=[_THISROW].[Production Id])))>>
<<End>>

Can you try this:

TOTALHOURS(SUM([Related Job Activities][Duration]))

1 Like

That did the trick. thank-you.

However, what if I want to take the same expression and drill down? For example,

<<Start: [Related Job Activities]>>
<<TOTALHOURS(SUM(SELECT(Job Activities[DURATION],AND([Production Id]=[_THISROW].[Production Id],[Production Assignment]=[_THISROW]."Packaging")))) >>
<<End>>

I would have to use a SELECT expression, correct?

Lastly, can you explain why my original formula didn’t work so I know the limitations of template expressions?

I don’t know why your original formula did not work.

As to how to drill down, if there are not too many cases, I would create slices of the Job Activities table and add another VC similar to [Related Job Activities] which is probably a REF_ROWS(“Job Activities”,“KeyCol”) formula referencing that slice - i.e., REF_ROWS(“Job Activities Slice”,“KeyCol”)