Forum Discussion
Average days between two dates
- 5 years ago
Hi Anonymous ,
According to your request, I did the following test: dateKey_FK is a separate date list, and there is no relationship between the two tables. Reference is as follows:
avg_day = VAR a = MIN ( dateKey_FK[Date] ) VAR b = MAX ( dateKey_FK[Date] ) VAR c = CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( ALL ( 'Table' ), 'Table'[Orderdate] >= a && 'Table'[RegisterOrderdate] <= b ) ) VAR d = CALCULATE ( SUM ( 'Table'[day_diff] ), FILTER ( ALL ( 'Table' ), 'Table'[Orderdate] >= a && 'Table'[RegisterOrderdate] <= b ) ) RETURN d / cBelow is the sample pbix file.
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Nice day
in excel I track tickets to validate the aging, but at the time of replicating it in PowerBi, I can not tell you in what case the ticket is not closed tell me how many days it has been open
Generate a column that said End_Date and tells me the day we are on and I can calculate with datediff the values between the 2 dates, but I need to add what is indicated in the excel form.
I appreciate your help with the topic
Since then I must typify it like this:
=YES. ERROR(IF([@[Open Days]]="CLOSED";" Closed";IF(Y([@[Open Days]]>=0;[ @[Open Days]]<=15);" 0-15 Days";Y(Y([@[Open Days]]>15;[ @[Open Days]]<=30);" 16-30 Days";Y(Y([@[Open Days]]>30;[ @[Open Days]]<=45);" 31-45 Days";SI([@[Open Days]]>=45;" Greater than 45 Days";" Verify")))));" Review")
I have all this in excel. and I want to replicate it in PowerBi