Forum Discussion

Atinder's avatar
Atinder
Helper III
3 years ago
Solved

Find Last purchase Cost

Hello,    I am need to Find my last invoiced purchased price and last Invoiced date. If there is no invoice leave it blank . I found the last invoice date with measure.  Date of Invoice = LASTDAT...
  • v-yueyunzh-msft's avatar
    v-yueyunzh-msft
    3 years ago

    Hi , Atinder 

    You can use these dax measures :

    Last Invoice date = LASTDATE('Purchase Rec'[Date Invoiced])
    Cost = CALCULATE( SUM( 'Purchase Rec'[COST]) , LASTDATE('Purchase Rec'[Date Invoiced]))

    (2)Then you can put them on the visual , the result is as follows:

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    Best Regards,

    Aniya Zhang

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

  • v-yueyunzh-msft's avatar
    v-yueyunzh-msft
    3 years ago

    Hi , Atinder 

    You can update the measure to this:

    Last Invoice date = MAX('Purchase Rec'[Date Invoiced])
    Cost = 
    var _last_date  = MAX('Purchase Rec'[Date Invoiced])
    return
    CALCULATE( SUM( 'Purchase Rec'[COST]) , 'Purchase Rec'[Date Invoiced]=_last_date)

    Then we can meet your need , the result is as follows:

     

    Best Regards,

    Aniya Zhang

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