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

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
Highlighted

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
Highlighted
Super User III
Super User III

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

Highlighted
Community Support
Community Support

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.
Highlighted

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.

Highlighted

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

Highlighted
Frequent Visitor

@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!

Highlighted

Hi @FiveStar 

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,028)