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.
Hello,
I need to count the number of orders by email address and Order Date based on the criteria:
1. Only count the order if the previous Order by email address is more then 60 days old.
As an example we don't count the second order by Mike because the order date is within 60 days.
We count the second order by Dave because more then 60 days have elapsed.
pls try this
Count =
VAR _t1 =
[Email]
VAR _tbl =
FILTER ( ALL ( 'Table' ), 'Table'[Email] = _t1 )
VAR _minDate =
MINX ( _tbl, [OrderDate] )
RETURN
SWITCH (
TRUE (),
[OrderDate] = _minDate
|| DATEDIFF ( _minDate, [OrderDate], DAY ) > 60, 1,
0
)
Hello,
This seems to work:
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Hello,
This is the sample data.
mike@test.com | 1/1/2023 | Yes |
mike@test.com | 2/1/2023 | No |
Dave@test.com | 1/1/2023 | Count |
Dave@test.com | 4/1/2023 | Yes more then 60 days |
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 |
---|---|
111 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |