Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table that contains 4 columns with scheduled dates in all of the columns. I need to count how many times an OG has a a date scheduled before a timeframe. I have over 200 rows and 12 OG's. When looking at this example and counting all instances for one OG before 5/1/2017. the result would be:
Milwaukee Operations 16
MInneapolis 7
I am new at Power BI and can not figure this out. A measure or calculated column will do. Thanks in advance!
OG | Schedule.1 | Schedule.2 | Schedule.3 | Schedule.4 |
Milwaukee Operations | 1/12/2017 | 4/20/2017 | 7/20/2017 | |
Milwaukee Operations | 1/12/2017 | 4/20/2017 | 7/20/2017 | |
Milwaukee Operations | 1/12/2017 | 4/20/2017 | 7/20/2017 | |
Milwaukee Operations | 1/19/2017 | 4/4/2017 | 7/13/2017 | |
Milwaukee Operations | 1/19/2017 | 4/4/2017 | ||
Milwaukee Operations | 1/19/2017 | 4/4/2017 | 4/25/2017 | |
Milwaukee Operations | 1/19/2017 | 4/4/2017 | ||
Milwaukee Operations | 1/30/2017 | 6/1/2017 | ||
Minneapolis Operations | 2/2/2017 | 8/1/2017 | ||
Minneapolis Operations | 2/2/2017 | 3/1/2017 | 4/5/2017 | 5/1/2017 |
Minneapolis Operations | 2/7/2017 | 3/1/2017 | 4/1/2017 | 9/1/2017 |
Solved! Go to Solution.
I assume you want the cutoff date to be dynamic?
One way of doing it is to use a 'disconnected slicer'. There are lots of good resources out there about this if you want to read up on it (e.g. http://exceleratorbi.com.au/wp-content/uploads/2017/02/SQLSat_MattAllington_DisconnectedTablesInDAX.... )
Here are the steps:
1. Bring in your data into a new .pbix file
2. Create a calendar table in the file as well. It should have a 'Dates' field with all of the dates that you might want to use to define your timeframe. (There are several ways to do this, but you could just click on the New Table button and copy and paste the data in). Make sure there is no relationship between the data table and the Calendar table
3. Create these measures (your table name may differ):
Date Filter = MAX('Calendar'[Dates]) Sch 1 Count = CALCULATE(COUNT(Table1[Schedule.1]), FILTER(Table1, Table1[Schedule.1] <= [Date Filter])) Sch 2 Count = CALCULATE(COUNT(Table1[Schedule.2]), FILTER(Table1, Table1[Schedule.2] <= [Date Filter])) Sch 3 Count = CALCULATE(COUNT(Table1[Schedule.3]), FILTER(Table1, Table1[Schedule.3] <= [Date Filter])) Sch 4 Count = CALCULATE(COUNT(Table1[Schedule.4]), FILTER(Table1, Table1[Schedule.4] <= [Date Filter])) Total Count = [Sch 1 Count] + [Sch 2 Count] + [Sch 3 Count] + [Sch 4 Count]
Then add a filter using your Calendar[Dates] field.
Also add a table that includes the OC field and the Total Count field.
I assume you want the cutoff date to be dynamic?
One way of doing it is to use a 'disconnected slicer'. There are lots of good resources out there about this if you want to read up on it (e.g. http://exceleratorbi.com.au/wp-content/uploads/2017/02/SQLSat_MattAllington_DisconnectedTablesInDAX.... )
Here are the steps:
1. Bring in your data into a new .pbix file
2. Create a calendar table in the file as well. It should have a 'Dates' field with all of the dates that you might want to use to define your timeframe. (There are several ways to do this, but you could just click on the New Table button and copy and paste the data in). Make sure there is no relationship between the data table and the Calendar table
3. Create these measures (your table name may differ):
Date Filter = MAX('Calendar'[Dates]) Sch 1 Count = CALCULATE(COUNT(Table1[Schedule.1]), FILTER(Table1, Table1[Schedule.1] <= [Date Filter])) Sch 2 Count = CALCULATE(COUNT(Table1[Schedule.2]), FILTER(Table1, Table1[Schedule.2] <= [Date Filter])) Sch 3 Count = CALCULATE(COUNT(Table1[Schedule.3]), FILTER(Table1, Table1[Schedule.3] <= [Date Filter])) Sch 4 Count = CALCULATE(COUNT(Table1[Schedule.4]), FILTER(Table1, Table1[Schedule.4] <= [Date Filter])) Total Count = [Sch 1 Count] + [Sch 2 Count] + [Sch 3 Count] + [Sch 4 Count]
Then add a filter using your Calendar[Dates] field.
Also add a table that includes the OC field and the Total Count field.
Thanks! This helped me solve my issue.
Oops - I used <= in the measures, when I think you just wanted <
Anyway, hopefully you get my point.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
71 | |
57 | |
38 | |
36 |
User | Count |
---|---|
81 | |
67 | |
61 | |
46 | |
45 |