Forum Discussion

dreyes6's avatar
dreyes6
Helper I
4 years ago
Solved

Add JOB ID amount only its current date

Hello, you might have some answers to this. I have a table and I need a sum of the amount of my jobID if the jobID about is its latest date. Below is my table ID Name Job ID  About  Date ...
  • dreyes6's avatar
    dreyes6
    4 years ago

    Hi, Thanks for the response, appreciate your help by the way can we try this table.

    NameJobIDAmountDate
    A11$41/1/2021 0:00
    A11$01/1/2022 0:00
    A62$01/1/2021 0:00
    A62$01/1/2022 0:00
    A21$11/1/2021 0:00
    A21$01/1/2022 0:00
    A101$58,4931/1/2021 0:00
    A101$53,1631/1/2022 0:00
    A77$1,0001/1/2021 0:00
    A77$01/1/2022 0:00
    A42$309/1/2020 0:00
    A85$01/1/2022 0:00
    A71$8,5071/1/2021 0:00
    A71$10,3211/1/2022 0:00
    A25$02/1/2021 0:00
    A49$2861/1/2021 0:00
    A49$01/1/2022 0:00
    A88$13,2932/1/2021 0:00
    A57$8,3261/1/2021 0:00
    A57$8,7991/1/2022 0:00

     

    so the total should be 

    $85,606

     

     

     

  • jdbuchanan71's avatar
    4 years ago

    dreyes6 

    If you want to total to show correctly as well, try it with a SUMX,

     

    Latest Amount = 
    SUMX (
        VALUES ( 'Table'[Job ID] ),
        VAR _MaxDate =
            CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Job ID] ) )
        RETURN
            CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Date] = _MaxDate )
    )

     

     

  • dreyes6's avatar
    dreyes6
    4 years ago

    Thank you this one works fine!