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 / Assistance Needed for ...
Power Apps
Unanswered

Assistance Needed for Line Chart Displaying Top 3 HSE Observation Categories

(0) ShareShare
ReportReport
Posted on by 29

Hello Power Apps Community,

I'm seeking assistance to create a line chart in Power Apps that plots two lines. The first line should display the top 3 HSE Observation Categories for the current month, and the second line should display the top 3 categories for the previous month.

I have slightly modified the App OnStart code (originally assisted by and modified by @WarrenBelz ) for a previous task to generate the top 3 observers, using similar logic to include the top 3 trending categories. Here is the code:

With(
{
_AllObservations: 'HSE Observations - KPO',
_StartThisMonth: Date(Year(Today()), Month(Today()), 1),
_EndThisMonth: DateAdd(Date(Year(Today()), Month(Today()), 1), 1, TimeUnit.Months) - 1,
_StartPrevMonth: DateAdd(Date(Year(Today())), Month(Today()), 1), -1, TimeUnit.Months),
_EndPrevMonth: Date(Year(Today()), Month(Today()), 1) - 1
},
With(
{
_CurrentMonthObservations: Filter(_AllObservations, DateValue(DateTime) >= _StartThisMonth && DateValue(DateTime) <= _EndThisMonth),
_PreviousMonthObservations: Filter(_AllObservations, DateValue(DateTime) >= _StartPrevMonth && DateValue(DateTime) <= _EndPrevMonth)
},
With(
{
_TopCurrentMonthObservers: FirstN(
Sort(
AddColumns(
GroupBy(
AddColumns(_CurrentMonthObservations, ObserverName, Observer.DisplayName),
ObserverName, ObserverGroup
),
ObservationCount, CountRows(ObserverGroup)
),
ObservationCount, SortOrder.Descending
),
3
),
_TopPreviousMonthObservers: FirstN(
Sort(
AddColumns(
GroupBy(
AddColumns(_PreviousMonthObservations, ObserverName, Observer.DisplayName),
ObserverName, ObserverGroup
),
ObservationCount, CountRows(ObserverGroup)
),
ObservationCount, SortOrder.Descending
),
3
),
_TopCurrentMonthCategories: FirstN(
Sort(
AddColumns(
GroupBy(
AddColumns(_CurrentMonthObservations, CategoryName, ObservationType.Value),
CategoryName, CategoryGroup
),
CategoryCount, CountRows(CategoryGroup)
),
CategoryCount, SortOrder.Descending
),
3
),
_TopPreviousMonthCategories: FirstN(
Sort(
AddColumns(
GroupBy(
AddColumns(_PreviousMonthObservations, CategoryName, ObservationType.Value),
CategoryName, CategoryGroup
),
CategoryCount, CountRows(CategoryGroup)
),
CategoryCount, SortOrder.Descending
),
3
)
},
ClearCollect(TopCurrentMonthObservers, _TopCurrentMonthObservers);
ClearCollect(TopPreviousMonthObservers, _TopPreviousMonthObservers);
ClearCollect(
CombinedCategories,
AddColumns(
_TopCurrentMonthCategories,
Month, "Current"
)
);
Collect(
CombinedCategories,
AddColumns(
_TopPreviousMonthCategories,
Month, "Previous"
)
)
)
)
)

 

The code works fine, but when I insert the line chart, I struggle to plot two separate lines. Instead, the chart displays one line with 3 categories for the current month and 3 for the previous month on the same line.

Is there any way to have Power Apps plot two separate lines on the same chart? Any help or guidance would be greatly appreciated!

Thank you in advance for your assistance.

 

Chart.PNG
LineChart Properties.PNG
Categories:
I have the same question (0)
  • kuspaar Profile Picture
    29 on at

    Or maybe I am trying to utilize wrong chart for the task... ? instead of line, stacked bars.. again whether it is supported by power app.. `

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard