Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Combine 2 total value in Line Chart

Hello,


I'm newbie in Power BI. I'm learning Power BI within 1 week and starting to practice more with some charts.

Now, I have the problem with the line chart.

 

I have the database which present the number of people leave the company in 2018 & 2019.

The idea is build the line chart as information below:

- the x-asis present 12 months

- the y-axis present the total of people leave the company in each month

- the line present the value of 2018 & 2019.

 

The problem is I don't know in Power BI how I can present 2 line (one of 2018, one of 2019) in the same chart.

I can do only for the 2018 or 2019 or the total of 2 years.

 

If I do it on excel, I have to create the table, calculate the total value of each month of each year. Then, I can draw it.

Do I need to calculate at the same way in Power BI?

 

 

2 Replies

  • TeigeGao's avatar
    TeigeGao
    Solution Sage

    Hi Anonymous ,

    We can create two measures to represent year 2018 and 2019 like below:

    Measure2018 = CALCULATE(COUNTROWS(Data),YEAR(Data[Date])= 2018)
    Measure2019 = CALCULATE(COUNTROWS(Data),YEAR(Data[Date])= 2019)

    Then drag these two measure to value, the result will like below:

    Best Regards,

    Teige

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you a lot.

      I will try