Forum Discussion

lennox25's avatar
lennox25
Icon for Post Patron rankPost Patron
2 years ago
Solved

Find the difference between two dates incorporating a deadline date

Hi,  Please see table.   If Date Delivered is 14/11/2023 for Apples the deadline is <=2 days to Date Sold. How do I add a column adding on each deadline day to each category. The list is long and ...
  • Ritaf1983's avatar
    2 years ago

    Hi lennox25 

    You can import those tables to power query and merge between them:

    extract from the string of deadlines only the number of dates :

    modify data type to number

    And add it to the sales date with a custom column

    modify a result as a date data type

    uncheck the option load to the model at the deadlines table ( you don't need it inside)

     

    Pbix is attached

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



  • Ritaf1983's avatar
    Ritaf1983
    2 years ago

    Hi lennox25 
    You can create 3 measures : "
    1.

    total_transactions = COUNTROWS(sales)

    over_deadline = CALCULATE([total_transactions],FILTER(sales,[over deadline days]<0))

    %_over = divide ([over_deadline],[total_transactions])
    + Format it as percent

    The updated pbix is attached

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

  • Ritaf1983's avatar
    Ritaf1983
    2 years ago

    Hi lennox25 
    Add a measure :

    in_deadline % = 1-[%_over]

    The updated pbix is attached

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