Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Good morning,
I am trying to find the average and median time of a customer’s arrival to different points of their visit and have it filter the result to only include two types of visit reasons.
I am using the following formulas
Door to Purchase = 'Door to purchase'[Purchase date time]-'Door to purchase'[Customer arrival date time]
Door to Purchase in seconds = HOUR('Door to purchase'[Door to purchase])*3600+ MINUTE('Door to purchase'[Door to purchase])*60+SECOND('Door to purchase'[Door to purchase])*1)
Average Duration Arrival to Purchase hh:nn:ss = FORMAT(AVERAGE('Door to purchase'[Door to Purchase in seconds]), 'hh:nn:ss")
This gives me the average time duration but I need to further filter it by reason for purchase.
I have these columns available
CAL reason for purchase Birthday = CALCULATE(COUNTROWS('Door to purchase'), CONSTAINSSTRING('Door to purchase'[Reason], "Birthday"))
CAL reason for purchase Wedding = CALCULATE(COUNTROWS('Door to purchase'), CONSTAINSSTRING('Door to purchase'[Reason}, "Wedding"))
Reason for Purchase is Birthday or Wedding = 'Door to purchase [CAL reason for purchase Birthday] +'Door to purchase [CAL reason for purchase Wedding]
Question 1 How do I find the average times filtering only customers with a purchase reason of Birthday or Wedding?
Question 2 How do I find the Median times filtering only customers with a purchase reason of Birthday or Wedding?
Any help is appreciated!
Hi @mhesli
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you
Hi @mhesli
I wanted to check if you had the opportunity to review the information provided by @Sahir_Maharaj . Please feel free to contact us if you have any further questions. If his response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @mhesli
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hello @mhesli,
Can you please try this approach:
Door to Purchase (Seconds) =
DATEDIFF(
'Door to purchase'[Customer arrival date time],
'Door to purchase'[Purchase date time],
SECOND
)
Avg Arrival to Purchase (Birthday/Wedding) =
CALCULATE (
AVERAGE('Door to purchase'[Door to Purchase (Seconds)]),
FILTER (
'Door to purchase',
CONTAINSSTRING('Door to purchase'[Reason], "Birthday")
|| CONTAINSSTRING('Door to purchase'[Reason], "Wedding")
)
)
Median Arrival to Purchase (Birthday/Wedding) =
MEDIANX (
FILTER (
'Door to purchase',
CONTAINSSTRING('Door to purchase'[Reason], "Birthday")
|| CONTAINSSTRING('Door to purchase'[Reason], "Wedding")
),
'Door to purchase'[Door to Purchase (Seconds)]
)
If possible, it would be great if you could you please provide sample data.
Many thanks.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
8 | |
6 |