Forum Discussion
Anonymous
4 years agoNot applicable
Group by based on DAX column
I have 2 tables in the model. In the firsttable I bring a column from the second table using DAX function RELATED.
Talble 1:
| Order ID | Product ID |
| 1628 | 1 |
| 9200 | 2 |
| 8615 | 3 |
| 3874 | 4 |
| 1057 | 1 |
| 7250 | 2 |
| 1243 | 3 |
| 4668 | 4 |
Table 2:
| Product ID | Price |
| 1 | 100 |
| 2 | 50 |
| 3 | 150 |
| 4 | 230 |
And the first table after bringing another column:
| Order ID | Product ID | Price |
| 1628 | 1 | 100 |
| 1628 | 2 | 50 |
| 8615 | 3 | 150 |
| 3874 | 4 | 230 |
| 1057 | 1 | 100 |
| 7250 | 2 | 50 |
| 3874 | 3 | 150 |
| 4668 | 4 | 230 |
Now I need a new table that will show me Order ID and the total amount:
| Order ID | Total Amount |
| 1057 | 100 |
| 1628 | 150 |
| 3874 | 380 |
| 4668 | 230 |
| 7250 | 50 |
| 8615 | 150 |
I tried to do it in a few ways and non recognizes the new price column.
I tried to add a table in the following way:
Total Price per order = SUMMARIZECOLUMNS(Orders[Order ID], "Total Order Price", Orders[Price])
I get the following error:
A single value for column rpice in table Prders cannot be determined..
What am I doing wrong?
(couldn't find a way to attach the file..)
Anonymous Try: Total Price per order = SUMMARIZECOLUMNS(Orders[Order ID], "Total Order Price", SUM(Orders[Price]))
1 Reply
- Greg_Deckler
Community Champion
Anonymous Try: Total Price per order = SUMMARIZECOLUMNS(Orders[Order ID], "Total Order Price", SUM(Orders[Price]))