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.
I have a unique situation that I'm used to handling in SQL, but I'm unsure how to deal with it in Power BI. I need a hit count on when a user appears in a table within the last 30 days for each line item. So it's not a grouping thing, and I'm not sure Calculate will work. I also have to join on the ClientName, ClientDOB, and another status field as it's the only unique identifier I have for the client and the true hit count I need.
Again I know how I would do a subselect on that same table in SQL, just not sure how I'd it in PowerBI. The SQL would look as so
SELECT
Date,
ClientName,
ClientDOB,
(
SELECT COUNT(*)
FROM MyTable
WHERE ClientName = MT.ClientName
AND ClientDOB = MT.ClientDOB
AND Date BETWEEN DATEADD(MT.Date, -30, Day) and MT.Date
) AS Last30DayCount
FROM MyTable MT
Date | ClientName | ClientDOB | Last30DayCount |
04/30/2016 | ClientName1 | 01/01/1970 | 1 |
05/10/2016 | ClientName1 | 01/01/1970 | 2 |
05/10/2016 | ClientName2 | 12/31/1974 | 1 |
05/26/2016 | ClientName1 | 01/01/1970 | 3 |
06/15/2016 | ClientName1 | 01/01/1970 | 2 |
06/15/2016 | ClientName2 | 12/31/1974 | 1 |
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 |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
21 | |
2 | |
2 | |
2 | |
2 |