0

Other formula problem

Hi again with another problem with formula.

if Actividades.Disciplinas.Discilina = "Civil" then
    sum('Horas Ganadas Plan') = " Civil"
end

Don't give me anything 

10 replies

null
    • Fred
    • 2 yrs ago
    • Reported - view

    Hi Rafael -

    I am unsure what you are trying to do with your 2nd line.

    Are you trying to sum the data in a field?

    Are you trying to set a field to = "Civil"?

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    Yes I try to sum the hours only the civil Disciplina. I will try to sum the (plan hours plan) but no result and the formula no have errors

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi  Rafael

     

    If 'Horas Ganadas Plan' is a field in Actividades the you should be able to do this in one line, something like

     

    sum(Actividades[Disciplinas.Discilina = "Civil"].'Horas Ganadas Plan')
    

     

    Regards John

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view
    1. No, the 'Horas Ganadas Plan' is in the Document table.
    2.  
    • John_Halls
    • 2 yrs ago
    • Reported - view

    Is the document table any of Actividades, Disciplinas or Discilina? Or is it another table altogether? If so is it linked to any of the other three?

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    Now I have Disciplinas, Actividades, and Documents all relationship to one to many and in the Documents have a field 'Horas Ganadas Plan' that I need to sum by Disciplina like ejemplo Civil or Electicidad but I can't for now.

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view
    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Rafael

    This works

    sum((select Disciplinas)[Disciplina = "Civil"].Actividades.Documentos.'Horas Ganadas Plan')
    

    This is complex because you are looking for totals on the Documentos table, and they really belong on the Disciplinas table. At first I thought you could go up the links and back down again but it will only sum for the Disciplina the current record is linked to. Hence having to use a select statement. From the Disciplinas table it's a simple

    sum(Actividades.Documentos.'Horas Ganadas Plan')
    

    Regards John

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    John works 👍👋 Many thanks, I never do that,  excelent.

    • John_Halls
    • 2 yrs ago
    • Reported - view

    My pleasure!

Content aside

  • Status Answered
  • 2 yrs agoLast active
  • 10Replies
  • 101Views
  • 3 Following