cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Bar chart Data Source - Grouping by Date

Hey guys, 

 

I was wondering if someone could help me with the final peace of the puzzle for a Bar Chart data source. 

 

Im using the below formula to pull through the chart items, which is correctly pulling in the journey and steps for the app user. However ideally I'd like to group the number of steps per day, so that there are no duplicate journey dates. 

 

I've attached the an image of the the below formula's results. 

 

Thank you in advance 😄  

 

Sort(
Filter(
ShowColumns(
WellbeingStepsChallenge_StepsLog,
"JourneyDate",
"Steps",
"UserEmail"
),
User().Email in UserEmail
),
JourneyDate,
Descending
)

 

tapper_0-1595793906196.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Bar chart Data Source - Grouping by Date

@tapper 

You'll want to begin my adding this code to the OnStart property of your app to store the User's email in a variable.

Set(varUserEmail, User().Email)


Then put this code in the Items property of your Chart

DropColumns(
    AddColumns(
            GroupBy(
                Filter(Wellbeing_StepsChallenge_StepsLog, UserEmail=varUserEmail),
                "JourneyDate",
                "GroupedDates"
            ),
        "Sum of Steps",Sum(GroupedDates, Steps)
        ),
    "GroupedDates"
)


You can learn how to GROUP BY and SUM tables of data here.  I adapted this method to your problem.

https://matthewdevaney.com/powerapps-collections-cookbook/group-by-and-find-the-sum/

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Bar chart Data Source - Grouping by Date

@tapper 

You'll want to begin my adding this code to the OnStart property of your app to store the User's email in a variable.

Set(varUserEmail, User().Email)


Then put this code in the Items property of your Chart

DropColumns(
    AddColumns(
            GroupBy(
                Filter(Wellbeing_StepsChallenge_StepsLog, UserEmail=varUserEmail),
                "JourneyDate",
                "GroupedDates"
            ),
        "Sum of Steps",Sum(GroupedDates, Steps)
        ),
    "GroupedDates"
)


You can learn how to GROUP BY and SUM tables of data here.  I adapted this method to your problem.

https://matthewdevaney.com/powerapps-collections-cookbook/group-by-and-find-the-sum/

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Frequent Visitor

Re: Bar chart Data Source - Grouping by Date

Hi @mdevaney  

 

Thank you so much for your help with this.... It worked perfectly you genius!

 

Thanks again 

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,933)