Forum Discussion
column value based on the values from two other columns
- 3 years ago
1. Identify a primary key in your data. In your case that is a composite key made up of Course Name and Student Grade which I implemented as a calculated column
2. Right click on that primary key column and create (or edit) a group. Now you can bucket collections of primary keys into your Class groups.
3. Use the Class groups column in your visuals.
The same can be achieved with lots of code in either Power Query or DAX, but the column group method is more convenient, and it is sufficient if you don't expect your data to change frequently.
lbendlin Thank you very much for your continued help. Below is some sample data with the results field being the Class Name column. Most of the values are the same as the Course Name column. All students need to be in either 7 Mathematics or 8 Mathematics based on their grade level and regardless of what actual math class they are in.
| Course Name | Student Grade | Class Name |
| 7 English | 7 | 7 English |
| 7 Integrated Science | 7 | 7 Integrated Science |
| 7 Language Arts | 7 | 7 Language Arts |
| 7 Mathematics | 7 | 7 Mathematics |
| 7/8 Algebra I | 7 | 7 Mathematics |
| 7/8 Algebra I | 8 | 8 Mathematics |
| 8 English | 8 | 8 English |
| 8 Integrated Science | 8 | 8 Integrated Science |
| 8 Language Arts | 8 | 8 Language Arts |
| 8 Mathematics | 8 | 8 Mathematics |
| Algebra II/Trig | 8 | 8 Mathematics |
| Hon. Algebra II/Trig | 8 | 8 Mathematics |
see attached
- Anonymous3 years agoNot applicable
lbendlin That looks fantastic! I appreciate you. Could you give me a quick explanation of how the "Class Name" column gets the values?
- lbendlin3 years ago
Super User
1. Identify a primary key in your data. In your case that is a composite key made up of Course Name and Student Grade which I implemented as a calculated column
2. Right click on that primary key column and create (or edit) a group. Now you can bucket collections of primary keys into your Class groups.
3. Use the Class groups column in your visuals.
The same can be achieved with lots of code in either Power Query or DAX, but the column group method is more convenient, and it is sufficient if you don't expect your data to change frequently.