web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / 2 Lines in a Line chart
Power Apps
Answered

2 Lines in a Line chart

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello guys, I need aid in an issue regarding my line chart as seen below. I currently have a filter on the line chart so as to seperate the data displayed by years. The data the chart is pulling from comes from my sharepoint list as seen below. Any help would be appreciated!

 

Kane2_0-1670301958739.pngKane2_1-1670301982803.png

@WarrenBelz @RandyHayes @Drrickryp 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    P.S. sorry i forgot to aid this in the original post. I am looking to develop a feature which can display both the lines of 2022 and 2023 in one chart.

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I made a sample for you:

     

    Create a list with two years of data.

    vxiaochenmsft_0-1670313120685.png

     

     

    Add a line chart, set Items to the following function and select Series.

    AddColumns(Filter(List26,Year="2021") As Temp ,"Y2022",LookUp(Filter(List26,Year="2022"),Temp.Season=Season).Number)

    In your database it should be:

    AddColumns(Filter(‘A350 Withdrawal Count’,Year="2022") As Temp ,"Y2023",LookUp(Filter(‘A350 Withdrawal Count’ ,Year="2023"),Temp.Month=Month).Withdrawal Count’)

    vxiaochenmsft_1-1670313120689.png

     

     

    Set the number of Series to display.

    vxiaochenmsft_2-1670313120690.png

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Kane2_0-1670313884191.png

    The code doesn't seem to work? Any help with regards to this?

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft Apologies it works now, just had some minor issues with my code. One last thing, is there a way I could possibly filter the chart based on the year using a dropdown per se, such as when the user selects 2022, it will only display the line for 2022, vice versa for 2023 and when the user selects all, the chart will then display both lines. Much appreciated!

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I made a sample for you:

     

    Add a dropdown in app.

    vxiaochenmsft_0-1670376359248.png

     

     

    Set 'items' to the following function.

    If(Dropdown1.Selected.Value="All",AddColumns(Filter('A350 Withdrawal Count',Year="2022") As Temp,"Y2023",LookUp(Filter('A350 Withdrawal Count',Year="2023"),Temp.Month=Month).'Withdrawal Count'),AddColumns(Filter('A350 Withdrawal Count',Year=Dropdown1.Selected.Value) As Temp,"Y2023",LookUp(Filter('A350 Withdrawal Count',Year="2022"),Temp.Month=Month).'Withdrawal Count'))

    vxiaochenmsft_1-1670376359254.png

     

     

    Set the number of Series to display.

    If(Dropdown1.Selected.Value=”All”,2,1)

    vxiaochenmsft_2-1670376359255.png

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-xiaochen-msft  majority of this solution works, however, when I select 2023 in the drop down, the line chart does not change to the appropriate dataset. How do I rectify this issue?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft Apologies it works now, it was just a mistake on my part when I inputted the wrong series in order. Much appreciated!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard