Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 |