Forum Discussion
Create a Calculated Column from Different Tables
I am attempting to add a column to a table in the Query Editor, using a column from a related table. I am getting an error "Token literal expected." The relationship between these tables has been set up. I've tried it with both the single quotation marks and without
- Sorry that's my bad. I happen to work on a French system and it is using ";" rather than comma ",".
You need to replace all ";" by the proper separator which should be comma for you.
10 Replies
- parry2kSuper User
jhendrickson you are using DAX formula in Query Editor which is not allowed. You can use same expression, and to do so, close query editor and add new coloumn in your table and then add this DAX expression.
Here is link for your reference on how to add columns.
- jhendricksonRegular Visitor
Thank you for the information. I tried this but now I'm getting a different error - A single value for the column can't be determined. I may have a bigger issue. Here is what I am trying to do:
I have one table listing school districts and building codes (multiple buildings per district) and another table with the pupils per district per year:
Table 1 Table 2
School Building Code School Year Pupils
AB 1000 AB 2018 200
AB 1001 AB 2017 300
CD 1002 CD 2018 400
CD 1003 CD 2017 500
etc etc
Finally I have a large table with all the raw financial information for all the districts, every transaction with a column for the year and the building code. I can do great charts of the financial information by school but I want to include a calculation of expenses per pupil. I want to be able to drill down to look at things like instructional expenses per pupil or transportation expenses per pupil in any given year. It seems like the only way to do this is to get a column in the financial information table which divides each transaction by the number of pupils per school, and the only way to get that is through the building code and year. Is there a formula which would look at the year and building code column in each row, then pull in the appropriate number of pupils?
- parry2kSuper User
share sample data in excel file and can give quick solution.