Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Incremental Average Where Average Increments by Fixed Range Quantity

Hi all,   I need to create a calculated column that will take the geometric average (geomean) of all values in the Qe column that are between two depth values (0.4ft below and 0.2ft above the curre...
  • mahoneypat's avatar
    6 years ago

    Not sure if I got the + and - part right, but this approach should work for your column.

     

    Geomean =
    VAR currentdepth = Depth[Depth (ft)]
    RETURN
    CALCULATE (
    GEOMEAN ( Depth[Qe] ),
    ALL ( Depth ),
    VALUES ( Depth[ParentID] ),
    Depth[Depth (ft)] >= currentdepth - 0.2,
    Depth[Depth (ft)] <= currentdepth + 0.4
    )
     

    If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

  • Anonymous's avatar
    Anonymous
    6 years ago

    One of my colleagues helped figure this one out, not sure if this is a best practice in DAX or not but it worked:

     

    Geomean =
    VAR currentdepth = Depth[Depth (ft)]

    VAR currentParentID = ( Depth[ParentID] )
    RETURN
    CALCULATE (
    GEOMEAN ( Depth[Qe] ),
    ALL ( Depth ),
    currentParentID = ( Depth[ParentID] ),
    Depth[Depth (ft)] >= currentdepth - 0.2,
    Depth[Depth (ft)] <= currentdepth + 0.4
    )