Forum Discussion
Counting dates that fall between date range in another table (M to M relationship)
- Anonymous3 years ago
Hi akmiller ,
I'm sorry I don't understand your needs very clearly, is a given month given between two dates in another table or in some other way? Can you provide me with the expected results you want in the form of a table.
You can refer to the following documents that may be helpful to you:
Solved: Check if record from table A falls within a date r... - Microsoft Power BI Community
Solved: Count items in table A if filter date from table B... - Microsoft Power BI Community
Solved: DAX for counting overlapping date ranges across mu... - Microsoft Power BI Community
Solved: Count Rows Falling between two dates ( from discon... - Microsoft Power BI Community
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi akmiller ,
I'm sorry I don't understand your needs very clearly, is a given month given between two dates in another table or in some other way? Can you provide me with the expected results you want in the form of a table.
You can refer to the following documents that may be helpful to you:
Solved: Check if record from table A falls within a date r... - Microsoft Power BI Community
Solved: Count items in table A if filter date from table B... - Microsoft Power BI Community
Solved: DAX for counting overlapping date ranges across mu... - Microsoft Power BI Community
Solved: Count Rows Falling between two dates ( from discon... - Microsoft Power BI Community
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, the second link (https://community.powerbi.com/t5/Desktop/Count-items-in-table-A-if-filter-date-from-table-B-falls-between/m-p/1220695) and specifically this code:
Serial Number in TB 1 =
VAR t =
FILTER (
TableA,
TableA[Start Date] <= MIN ( 'Created date from table B'[Created Date] )
&& TableA[End Date] >= MAX ( 'Created date from table B'[Created Date] )
)
RETURN
COUNTROWS ( FILTER ( t, [Serial Number] IN VALUES ( TableB[Serial Number] ) ) )
Got me where I needed to be. Thanks for your help!