cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FiveStar
Level: Powered On

Chart Item Syntax

Please help me understand how the syntax for ITEMS works when populating a bar chart.

 

my source is '[dbo].[tEntries]'

X axis should be column named [AreaID]

y axis shoul be column named [ID]

 

If i can get this down, I can work the filter but my god, can't seem to understand this or find out the syntax for it anywhere.

 

Much appreciated!!!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Chart Item Syntax

Hi @FiveStar 

The best way to do this is to create a view in SQL Server. By creating a view, the execution of the chart will be fast because the data aggregation will be performed at the server, and you won't have any problems with delegation.

The definition of your view would look something like this:

 

CREATE VIEW [ChartView]
AS
SELECT B.AreaDescription, A.ProjectId, A.CountOfID
FROM
(SELECT AreaID, ProjectID, Count(AreaID) AS [CountOfID] FROM [dbo].[Entries] GROUP BY AreaID, ProjectID) AS A
JOIN [dbo].[Areas] B
ON A.AreaID = B.AreaID

Once you've perfected a view that returns the correct data, you can add that view to your data source.

Then in your chart chart control,  you can set the Items property to:

Filter([dbo].[ChartView], ProjectID=varSelectedID )

You would set the Labels property of your chart to AreaDescription, and the Series1 property to CountOfID.

 

 

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Chart Item Syntax

Hi @FiveStar 

To create this type of chart, I would set the Items property to the name of your table, the labels property to AreaID, and Series1 to ID. Hopefully, that'll produce the output that you need.

 

image.png

Community Support Team
Community Support Team

Re: Chart Item Syntax

Hi @FiveStar ,

Could you please share a bit more about your scenario?

Do you want to render your SQL Table records in a Column chart within your app?

 

I have made a test on my side, please take a try with the following workaround:8.JPG

Set the Items property of the ColumnChart1 to following:

'[dbo].[tEntries]'

then specify the Labels property to the AreaID column in your SQL Table, specify the Series1 property to the ID column in your SQL Table.

 

Please also check and see if the following video would help in your scenario:

https://www.youtube.com/watch?v=22HqqVp-I80

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
FiveStar
Level: Powered On

Re: Chart Item Syntax

Thank you @timl and @v-xida-msft for your support thus far.

What you both proposed works for the simplest of scenarios, can I please venture to ask for help in continuing this syntax to solve my specific problem. If you recommend I mark your solution as solved I can do that as well.

 

So,

 

Table dbo.Entries has the [ID] column which needs to count the total amount of [AreaID] (foreign key) (y axis).

 

There is another table called dbo.Areas which has [AreaID] (Primary key) and a column called [AreaName] from which I would like to set the x axis to.

 

In dbo.Entries there is a column called [ProjectID] (Foreign key) from which I would like the graph to filter only the [ProjectID] which is selected on the first screen of the app. Once the user selects a Project on the first screen a variable called {varSelectedID} is set.

 

I really appreciate you efforts in helping me finish this. The graph is some sugar for the app which is otherwise functioning well and adding value to my organization.

 

Thanks!

 

P.S.

Yes, @v-xida-msft  I am trying to render Azure SQL table records in a column chart within my app to allow users to visualize entry count for each project. Thanks.

Super User
Super User

Re: Chart Item Syntax

Hi @FiveStar 

The best way to do this is to create a view in SQL Server. By creating a view, the execution of the chart will be fast because the data aggregation will be performed at the server, and you won't have any problems with delegation.

The definition of your view would look something like this:

 

CREATE VIEW [ChartView]
AS
SELECT B.AreaDescription, A.ProjectId, A.CountOfID
FROM
(SELECT AreaID, ProjectID, Count(AreaID) AS [CountOfID] FROM [dbo].[Entries] GROUP BY AreaID, ProjectID) AS A
JOIN [dbo].[Areas] B
ON A.AreaID = B.AreaID

Once you've perfected a view that returns the correct data, you can add that view to your data source.

Then in your chart chart control,  you can set the Items property to:

Filter([dbo].[ChartView], ProjectID=varSelectedID )

You would set the Labels property of your chart to AreaDescription, and the Series1 property to CountOfID.

 

 

View solution in original post

FiveStar
Level: Powered On

Re: Chart Item Syntax

@timl 

Thank you very much!

Works like a charm, now I can play with the look of the charts and I'm DONE!

I have the data going to a beautfiul Power BI dashboard, and have that integrated in the app as well. Problem is not all users have licenses and to cut costs and deliver only the required data in a visual helps a lot.

 

Once again, I apreciate your time and cant believe I didn't think about making the view in SSMS.

Cheers!

Super User
Super User

Re: Chart Item Syntax

Hi @FiveStar 

Thanks for the update. I'm really pleased you got this working so well!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,568)