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!!!
Solved! Go to Solution.
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.
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.
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:
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,
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.
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.
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!
Hi @FiveStar
Thanks for the update. I'm really pleased you got this working so well!
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
271 | |
227 | |
78 | |
38 | |
37 |
User | Count |
---|---|
344 | |
226 | |
122 | |
71 | |
55 |