Forum Discussion
Most recent value by material by customer
You will need to delete your first calculated column in order for the new one to calculate. Also, I did mine so it would work as a measure. You woull not need the SELETEDVALUE in the variables if you are doing it as a calculated column.
It did work as a measure but I think I need it to be a calculated column. Thanks for all the help thus far this is sort of out of my depth haha
- jdbuchanan717 years ago
Super User
Do you have multiple calculated columns in your table? If so, that can cause problems when you try to add one that is based on the table you are calcing against (like we are). Can you tell us a bit more about what you are trying to accomplish? There might be another way to get to the same answers.
- Anonymous7 years agoNot applicable
Im trying to get list prices for our material numbers so that I can then make a "sales margin calculator." However, the only table I can get the list and costs from is a sales table. Unfortunately, this is not a relational table and due to the many instances customers have bought the same product, I need to take the list price from the last transaction. When I did this with the old calculated column it worked but it created an issue where only the last transaction per material would show rather than the last transaction per material by customer.
There are no other calculated columns on the table.
- Cmcmahan7 years ago
Resident Rockstar
Just change the top to this:
VAR Customer = SELECTEDVALUE('Book for Promos'[BuyingGroupName])
VAR Material = SELECTEDVALUE('Book for Promos'[MaterialNo])When you're creating a measure, any time you name a column, it comes back as the entire column of data (even if that column is only one row). SELECTEDVALUE([column]) gives you a single value of the first thing in the column.
When creating a calculated column, naming a column returns a single value, since DAX knows it's working with one point of data.