This is how the question was asked
Asked by whom in which context?
Anyway, I think you need to talk to those persons for clarification. I can't make heads or tails of that accounts table. There are multiple rows for the same accountid what does that mean? There are four rows for accountid 1, three for userid 101 and one for userid 107. I could get that accountid may be related to the user, but the we would need a userid in transactions.
Your expected output is also very strange. Between Jan 1st and Jan 10th the number of users for the last 7 days varies between 0 and three, but there is only a single account that has transactions in this interval?
It seems that you need to go back and investigate what the users are really looking for, but here is a query that you maybe can work from. The dates table is your date dimension.
SELECT d.d, t.Last7DaysUserCnt, a.OpenAcc, isnull(t.Last7DaysUserCnt / nullif(a.OpenAcc, 0), 0)
FROM NorthNumbers..Dates d
CROSS APPLY (SELECT COUNT(DISTINCT a.userid)
FROM transactions t
JOIN accounts a ON t.accountid = a.accountid
WHERE convert(date, t.tdate) BETWEEN dateadd(DAY, -6, d.d) AND d.d) AS t(Last7DaysUserCnt)
CROSS APPLY (SELECT COUNT(DISTINCT a.userid)
FROM accounts a
WHERE a.createddate <= d.d
AND a.closeddate >= dateadd(DAY, -6, d.d)) AS a (OpenAcc)
WHERE d.d BETWEEN '20200101' AND '20200110'
ORDER BY d.d
