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

Notifications

Announcements

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

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:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    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
    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
    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
    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
    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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard