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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Caiz
Frequent Visitor

Display 2 lines for different years in a line chart

I have a table "GA Logo Churn", which has a calculated column named "% Logo Churned". The data looks like this:

 

table example.PNG

 I am trying to show a line for the Logo Churns of the last 12 months (march 2020-march 2021) and another for the year before that (march 2019-march 2020). When I add these into the line graphs they combine values instead of show separate for different years.

 

How do I get it to show the 2 line graphs for each year?

 

Thanks

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Caiz ,

You could try the following steps:

Step1,create a sort table as below:

v-luwang-msft_0-1618823225681.png

Step 2, use the following measure  and then new column base on the measure:

newyear = 
IF (
    (
        MAX ( 'Table'[Year] ) = 2019
            && MAX ( sort[sort] ) >= 3
    )
        || (
            MAX ( 'Table'[Year] ) = 2020
                && MAX ( sort[sort] ) < 3
        ),
    "2019 mar to 2020 mar",
    IF (
        (
            MAX ( 'Table'[Year] ) =2020
                && MAX ( sort[sort] ) >= 3
        )
            || (
                MAX ( 'Table'[Year] ) = 2021
                    && MAX ( sort[sort] ) < 3
            ),
        "2020 mar to 2021 mar",  IF(MAX ( 'Table'[Year] ) = 2019
            && MAX ( sort[sort] ) <3,"before 2019 mar",
        "after 2021 mar"
    )
))

v-luwang-msft_1-1618823364985.pngv-luwang-msft_2-1618823376070.png

 

Base on the two steps ,to create visualization:

v-luwang-msft_3-1618823587404.png

If you want something more natural, you could try the following solutions:

v-luwang-msft_4-1618824380937.png

And final you will get the below:

v-luwang-msft_5-1618824414441.png

You could download my pbix file to learn more details!

 

 

Wish it is helpful for you!

Best Regards

Lucien

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

Hi @Caiz ,

You could try the following steps:

Step1,create a sort table as below:

v-luwang-msft_0-1618823225681.png

Step 2, use the following measure  and then new column base on the measure:

newyear = 
IF (
    (
        MAX ( 'Table'[Year] ) = 2019
            && MAX ( sort[sort] ) >= 3
    )
        || (
            MAX ( 'Table'[Year] ) = 2020
                && MAX ( sort[sort] ) < 3
        ),
    "2019 mar to 2020 mar",
    IF (
        (
            MAX ( 'Table'[Year] ) =2020
                && MAX ( sort[sort] ) >= 3
        )
            || (
                MAX ( 'Table'[Year] ) = 2021
                    && MAX ( sort[sort] ) < 3
            ),
        "2020 mar to 2021 mar",  IF(MAX ( 'Table'[Year] ) = 2019
            && MAX ( sort[sort] ) <3,"before 2019 mar",
        "after 2021 mar"
    )
))

v-luwang-msft_1-1618823364985.pngv-luwang-msft_2-1618823376070.png

 

Base on the two steps ,to create visualization:

v-luwang-msft_3-1618823587404.png

If you want something more natural, you could try the following solutions:

v-luwang-msft_4-1618824380937.png

And final you will get the below:

v-luwang-msft_5-1618824414441.png

You could download my pbix file to learn more details!

 

 

Wish it is helpful for you!

Best Regards

Lucien

FrankAT
Community Champion
Community Champion

Hi @Caiz ,

use a measure instead of a calcultated column like this:

15-04-_2021_17-47-11.png

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Caiz
Frequent Visitor

Hi there @FrankAT , how did you set up the line chart I can't get mine looking like this? What table columns did you put in what section? Also what would Sum of Value do in the chart if I'd like the Y axis to be % Logo Churned? This is what mine looks like:

Churned.PNG

amitchandak
Super User
Super User

@Caiz , Not very clear. Refer to these two blogs. Change the duration as per need

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retenti...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.