Forum Discussion
calculate days count between 2 dates
To calculate the number of days between the purchase date and the transfer date for each item in Power BI, you can create a new column using the DATEDIFF function12. Here’s an example of how you might write this:
Days Count =
CALCULATE(
DATEDIFF(
MINX(FILTER(Table1, Table1[type] = 3), Table1[date]),
MAXX(FILTER(Table1, Table1[type] = 22), Table1[date]),
DAY
),
ALLEXCEPT(Table1, Table1[item], Table1[transaction number], Table1[branch])
)In this formula, Table1 is the name of your table. This formula calculates the number of days between the minimum date (purchase date) and the maximum date (transfer date) for each combination of item, transaction number, and branch. The ALLEXCEPT function is used to remove any filters that might limit the rows being evaluated, except for the filters on the item, transaction number, and branch columns12.
Please replace Table1 with your actual table name. If you need further assistance or have more specific requirements, feel free to ask! 😊
Thank you for your Replay , I want to inform you that the transaction number is different between purchase and transfer order
the purchase order transaction number can be (scr-10023)
the transfer number can by (scr-2324)
and so on there is no related betwwen them