Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I have a table (Account) with 5 columns (simplified for simplicity sake).
There's also and table with calendar dates ([Dates]).
I want to know the total count of unique codes per day (date) where
AML = 1 and the date is greater than/equal to start date and less than end date.
I'm hoping to create a measure or even calculated column (and then create measure off that)
I have tried a few things but none seem to do the trick.
Count AML:=
COUNTROWS (
FILTER(
Account,
Account[Start Date] <= RELATED('Dates'[Date])
&& Account[End Date] >= RELATED('Dates'[Date])
&& (Account[AML]= 1)
))
Appreciate any help.
[Account] table below. Only column id is unique
id,code,Start Date,End Date, AML
1,123,2018-12-12,2018-12-13,1
2,123,2018-06-25,2018-12-12,1
4,456,2018-06-25,2018-12-12,1
5,789,2018-06-25,2018-11-01,0
e.g
Eg date: 2018-06-24
Total count for code 123 is 0
Total count for code 456 is 0
Total count for code 768 is 0
Eg date: 2018-06-25
Total count for code 123 is 1
Total count for code 456 is 1
Total count for code 789 is 0
Eg date: 2018-06-26
Total count for code 123 is 1
Total count for code 456 is 1
Total count for code 768 is 0
Eg date: 2018-10-31
Total count for code 123 is 1
Total count for code 456 is 1
Total count for code 768 is 0
Eg date: 2018-12-12
Total count for code 123 is 1
Total count for code 456 is 0
Tota count for code 789 is 0
Eg date: 2018-12-13
Total count for code 123 is 0
Total count for code 456 is 0
Total count for code 768 is 0
Do this in Power Query. Create a table with columns Date,Code,TotalWithAML. Date column will hold all the dates from your Dates table. Code will hold all the possible codes. TotalCountWithAML will be easy to calculate in Power Query. Once you have such a table, you join Date to Dates[Date] and Code to Account[Code] or some table that will hold the unique codes... Then you can slice and dice to your heart's content.
Best
Darek
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |