Forum Discussion
Line chart counting dates
- 2 years ago
Hello ER,
Here is the solution on what I understood from your example.
Create a date table if you already have it well and good else just create a date table here is the code.
DateTable = ADDCOLUMNS( CALENDAR( DATE(2024, 1, 1), // Start Date: 1st January 2024 TODAY() // End Date: Today's Date ), "Year", YEAR([Date]), "Month", MONTH([Date]), "Day", DAY([Date]), "Month Name", FORMAT([Date], "MMMM"), "Year Month", FORMAT([Date], "YYYY-MM"), "Quarter", QUARTER([Date]), "Weekday", WEEKDAY([Date]), "Weekday Name", FORMAT([Date], "dddd"), "IsWeekend", IF(WEEKDAY([Date], 2) > 5, TRUE, FALSE), "Week Number", WEEKNUM([Date]) )Once you have the date table create one to many relationship from date table to the data table. You will create 3 relationship 1 will be active and the other two will be inactive. I have created an active relation between date and recruit start and rest are inactive.
Now once you have the relation you just need to create a count measure using the userelationship function. Below are the three measures:
Recruitstart = COUNT(Data[Recruit Start]) CertRecieved = CALCULATE(COUNT(Data[CERT RECEIVED]),USERELATIONSHIP(Data[CERT RECEIVED],DateTable[Date])) AnnouncementOpen = CALCULATE(COUNT(Data[ANNOUNCEMENT OPEN]),USERELATIONSHIP(Data[ANNOUNCEMENT OPEN],DateTable[Date]))Now just put then in matrix where rows will be the month-year field from date table and then in values put these measures. Below is the output that comes up. Hope this is what you are also trying to achieve.
It worked like a charm! And I learned a few things today. Thanks for your help!