cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

AddColumns syntax

Hi,

 

I have a collection on app start called "MHStats" it brings in a sharepoint list.

 

Inside the sharepoint list there is a Field called "Are you ok?" the possible answers are yes, no and neutral.  I also have a Date Time (string) field captured.  which is mm/dd/yyyy hh:mm:ss

 

I would like to plot a line graph with the yes, no and neutral on the Y axis and the date time on the x axis and insert this on a power app canvas screen.

 

I am struggling with the format of the AddColumns formula in the Items control of the line graph.

 

Any ideas?

 

Thanks in advance.

 

Jon

13 REPLIES 13
mdevaney
Super User
Super User

@Anonymous
Is your goal to show the Count of Yes, No or Neutral responses on each date? From your description it sounds like you want to have each on a separate line.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
Anonymous
Not applicable

No it would be one line, tracking the feeling (y axis) for each date it has been submitted on the x axis

@Anonymous
OK, can you please explain what column you need to add and what info goes in it?
Anonymous
Not applicable

So the X axis would be the date, the y axis would be yes, no or neutral.  The data will look something like this

 

table.JPG

 

Then the graph would look something like this:

graph.JPG

 

@jdrussell28
Yes, Neutral and No are not numbers so they can’t be represented on a line chart. To convert them to a number you can try this. Note: I am typing on a phone so you will have to retype the quotation marks or else you will get an error.

AddColumns(your_datsource_name, “Score”, Switch(your_options_column_name, “Yes”, 3, “Neutral”, 2, “No”, 1))


Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
Anonymous
Not applicable

Ok, I think the formula is working, but I still don't see any line on the graph:

 

graph.JPG

@Anonymous
They won’t show automatically. Click on the chart and go to the right side menu and advanced settings. You will be able to change the Series settings there.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
Anonymous
Not applicable

Thanks for your help so far, in advanced I have muiltiple Series drop downs:

 

multiple series.JPG

And the ClearCollect on App Load looks like:

 

ClearCollect(MHStats,'Mental Health');

 

I imagine I just need to pull through the Are you Ok? and the Date Time fields ?  How do I do this ?

 

Thanks,

 

Jon

@Anonymous
Your date and time field should go in the Label property and Score should be Series1

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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,018)