Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I try to write a measure which can calculate average days between orderdate and register_orderdate. In slicer two dates can be selected. For example:
In my tabular I have a seperate column for date which I use in slicer; dateKey_FK (20210401 , 20210610,...)
and in table in report:
Can you please guide me how I can write measure for 'Average_registerdate'
Solved! Go to Solution.
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 / c
Below 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
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 / c
Below 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.
@Anonymous , This filter is on which date- orderdate or register_orderdate ?
you can get Avg as
averageX(Table, Datediff(orderdate, register_orderdate, day))
It's based on datekey_FK.
@Anonymous , sorry I did not get it yet. But how datekey_FK is related to the data you have shown or how you want it to be related?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |