Forum Discussion

h11's avatar
h11
Helper III
1 year ago
Solved

Line Chart - Project Created vs Project Completed

Hello All,

 

My team has requested a line chart comparing "Tasks Completed per Month" and "Tasks Created per Month." I have data for approximately 250 projects and have attached a sample with 4 projects for reference. Could you please provide the formula to create a line graph where the X-axis represents months, and the Y-axis has two lines: one for the "Count of Tasks Completed per month" and the other for the "Count of Tasks Created per month"?

 

I request to attach the Power BI file if possible that you worked on using my data as a reference. Thank you in advance.

 

Project NameTask NameTask StatusTask Created DateTask Completed Date
ATask 1Completed12/11/202412/13/2024
ATask 2Created12/13/2024 
ATask 3Created12/13/2024 
ATask 4Completed12/16/202412/23/2024
ATask 5Created12/11/2024 
BTask 1Created12/12/2024 
BTask 2Completed12/12/202412/12/2024
BTask 3Created12/11/2024 
BTask 4Completed12/13/20241/16/2025
BTask 5Created12/16/2024 
CTask 1Created12/13/2024 
CTask 2Created12/12/2024 
CTask 3Completed12/16/202412/16/2024
CTask 4Created12/11/2024 
CTask 5Completed12/16/20241/7/2025
DTask 1Completed12/11/20241/3/2025
DTask 2Completed12/13/202412/16/2024
DTask 3Created1/16/2025 
DTask 4Created1/16/2025 
DTask 5Created1/16/2025 

 

  • Hi h11 

    Assuming you have a calendar table,
    you need to create two relationships between it and the tasks table:

    An active relationship with the task creation date.
    An inactive relationship with the task completion date.
    As shown in the attached image

    Then you can create 2 measures :

    Created tasks = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Task Status]="Created"))
    Completed tasks = CALCULATE(COUNTROWS('Table'),USERELATIONSHIP('Calendar'[Date],'Table'[Task Completed Date]),'Table'[Task Status]="Completed")
    Put the measures + month column from calendar table on the graph :

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

4 Replies

  • Hi h11 

    Assuming you have a calendar table,
    you need to create two relationships between it and the tasks table:

    An active relationship with the task creation date.
    An inactive relationship with the task completion date.
    As shown in the attached image

    Then you can create 2 measures :

    Created tasks = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Task Status]="Created"))
    Completed tasks = CALCULATE(COUNTROWS('Table'),USERELATIONSHIP('Calendar'[Date],'Table'[Task Completed Date]),'Table'[Task Status]="Completed")
    Put the measures + month column from calendar table on the graph :

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

    • h11's avatar
      h11
      Helper III

      Ritaf1983 : Thank you so much for attaching the pbi file. This saved my time. I appreciate it!

       

      Could you provide a measure that excludes the task status? I want to create a line graph using only the months and the created and completed dates, without including the task status into the measure.

       

      Thank you in advance!