cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SofticKabir
Helper III
Helper III

Line chart with (custom) date range

Hello,

 

I want to create a chart which would then display the amount of cases of a person between 01. January and 31. December 2021.

 

When a user creates a report, his Fullname is stored as well as the date of creation.

 

For example if there are 5 reports that were created on the same day, the chart would display 5 bars of different color for the same date.

 

It would look like something like this (without displaying the time, but only the date in "dd/mm/yyyy" format) :

Screenshot 2021-04-28 143052.png

How can one achieve this?

 

Best regards,

 

Softic Kabir

9 REPLIES 9
rubin_boer
Super User
Super User

hi @SofticKabir consider adding a column with the format as you wish like

Items = AddColumns(YourDataSource,"myDate",Text(YourDateColumn,"[$-en-US]dd/mm/yyy")) 

 

Set the Labels to myDate

 

rubin_boer_0-1619615330969.png

 

hope this helps

 

Hi @rubin_boer ,

 

thank you for the suggestion. I applied that but there are still some things that are not correct.

 

For example I want to display the date (from left to right on the x-axis) 01/01/2021 until 31.12.2021. And the line should be on the days where there were cases that day. Y-axis is then the amount of the cases.

 

For the moment it looks like this (after having applied your suggested change):
Screenshot 2021-04-28 153619.png

rubin_boer
Super User
Super User

hi @SofticKabir I have recreated this on my side:

5 entries with 2 being on the same date with different times

rubin_boer_0-1619631522135.png

the above is a collection where i added the column with the formatted date (no timestamp)

ClearCollect(colChartData,AddColumns(YourDataSource,"myDate",Text(YourDateColumn,"[$-en-US]dd/mm/yyyy")));

 

Now i added the chart and sorted the data in the chart by the "myDate" column I added above as well as group the data by the myDate as you want to have a count as to how many entries on that day

Sort(AddColumns(GroupBy(colChartData,"myDate","Grouped Date"),"Vals",CountRows('Grouped Date')),myDate,Ascending)

 

rubin_boer_1-1619632181548.png

the chart is now sorted by date and show the total of entries by date (26/4/2021 had 2 entries)

 

the series include the values (counts of entries) by new date columns

rubin_boer_2-1619632266113.png

 

i hope this helps

Hey @rubin_boer ,

 

I tried to apply your suggestion again but something is wrong in the code. I am not sure what exactly but this is what I have:

 

Sort(AddColumns(GroupBy(Table1.Datum;"_myDate";"GroupedDate");"Vals";CountRows(GroupedDate));_myDate;Ascending)

It says "The function "Sort" has invalid arguments" and "The function "GroupBy" has invalid arguments"

rubin_boer
Super User
Super User

@SofticKabir can you share a picture of your data (column names and data).

Sort(AddColumns(GroupBy(Table1;"Datum";"GroupedDate");"Vals";CountRows(GroupedDate));Datum;Ascending)

 

Can you also try the change i made above.

I tried that code, it shows no error anymore but the result is still not correct 🙂

Here is a screenshot of my colum "Datum". And a screenshot of my column "Erstellt von" which translates into "created by".

Screenshot 2021-04-29 160246.pngScreenshot 2021-04-29 160437.png

rubin_boer
Super User
Super User

hi @SofticKabir i used your headers and created this. 

rubin_boer_0-1619713184681.png

 

Can you please draw a graph in excel to show what you are looking for. the graphs in PowerApps can't be layered/stacked

 

The table is like yours (Table 18)

It is then grouped by days to get the count for that day (AddColumns(GroupBy(Table18,"Datum","Grouped"),"Total",CountRows(Grouped)))

 

both charts have the grouped data as Items.

 

 

 

Hi @rubin_boer 

 

This seems to work. It displays the number of cases for each day accordingly.

But, I noticed something strange. My "Table1" is a spreadsheet which is stored over OneDrive. I am also using Data Connection of OneDrive, so normally the data in the app should be the same as in the table. Somehow, the dates aren't the same, for example in the app I have 3 cases:

 

04.04.2021John Doe
01.03.2021Kabir Softic
01.03.2021Kabir Softic

 

These dates look different in my spreadsheet:

 

Screenshot 2021-05-01 114955.png

Do you know why this might be like this?

SofticKabir
Helper III
Helper III

The problem still persists...

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,958)