Forum Discussion

Freeseman's avatar
Freeseman
Helper II
3 years ago
Solved

Total Divided by Unique ID count

Hi All,   Do i need to write this is SQL or is it possible as a meassure in Power Bi.   I need to take the total payload result being the Last record of weight type B 98.5 and devide it by the co...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Freeseman ,

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _maxdate=
    MAXX(FILTER(ALL('Table'),'Table'[HAUL_CYCLE_REC_IDENT]=MAX('Table'[HAUL_CYCLE_REC_IDENT])&&'Table'[Group]<>"T")
    ,[TIMESTAMP])
    var_sum=
    SUMX(FILTER(ALL('Table'),'Table'[HAUL_CYCLE_REC_IDENT]=MAX('Table'[HAUL_CYCLE_REC_IDENT])&&'Table'[TIMESTAMP]=_maxdate),[PAYLOAD])
    var _count=
    COUNTX(FILTER(ALL('Table'),
    'Table'[HAUL_CYCLE_REC_IDENT]=MAX('Table'[HAUL_CYCLE_REC_IDENT])&&'Table'[TIMESTAMP]<_maxdate),[Group])
    return
    DIVIDE(
        _sum,_count)

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly