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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.