Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
ER_newatpowerbi
New Member

Line chart counting dates

Hi,

 

New to this so apologize in advance if I can't articulate this correctly.

I have been trying to create a chart with a line counting items each month. Here's an image below:

IMG_4928.png 
I've been unable to create three lines for Recruit Start, Announcement Open, and Cert Received showing their outputs each month. I am able to get a chart with three lines but it's dependent on the Recruit Start. Instead, I am trying to count them separately. 

I've tried different ways through different posts here but I can't get it right. 

Hope this makes sense. Thanks in advance for your help. 

1 ACCEPTED SOLUTION
DatawithDinesh
Resolver II
Resolver II

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.

DatawithDinesh_0-1723636556129.png

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.

 

DatawithDinesh_1-1723636720135.png

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ER_newatpowerbi ,

It is glad that the solution DatawithDinesh offered help you slove it, you can accepr the way  DatawithDinesh offered as a solution so that more user can refer to it.

 

Best Regards!

Yolo Zhu

 

ER_newatpowerbi
New Member

It worked like a charm!   And I learned a few things today.  Thanks for your help!

DatawithDinesh
Resolver II
Resolver II

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.

DatawithDinesh_0-1723636556129.png

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.

 

DatawithDinesh_1-1723636720135.png

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.