Forum Discussion
Filter Costs by Region, or Update Query Data with Proper Costs Column
Hi Everyone,
I could use some help in figuring out how to best find the aggregate costs of goods sold based on region.
Say a good costs $1 in the US, $2 in Europe, and $3 in Asia. Each specific sale is a separate row in my data set, however the cost of the good is not directly mapped to the sale based on region. I have a column that states which sale the region was made, but for the cost, I have separate columns for the $1, $2, and $3(the US Cost column has $1 for every row, Europe shows $2 for every row, etc.) . Is there a way to connect the proper cost for each sale in a single column (i.e. if the sale was in Europe, it will know to make the cost column say $2)? Or, is there an M code to filter it by cost based on region?
For example, I have the costs for each region placed in separate columns (EMEA = EU and APAC = AP - in the region column). Is there a way I can make a new column that assigns the appropriate cost for each row depending on the region, rather than having three separate columns? Or is there an M code that can filter it out at a later stage?
Thanks!
- Anonymous7 years ago
Actually I think I figured it out.
Just needed to click the add column tab in the query editor. Then create a new conditional column.
3 Replies
- v-xicaiCommunity Support
Hi Anonymous ,
I am not sure what desired result would you want, could you please share your sample data or desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
Please read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Thanks for the post link.
To clarify, i'd like to have a new column that maps the appropriate cost based on region for each row.
As in,
Region | Cost
Row 1 | US | $1
Row 2 | AP | $3
Row 3 | EU | $2
Since i do not have the data structured in that way at the moment.
Thanks!
- AnonymousNot applicable
Actually I think I figured it out.
Just needed to click the add column tab in the query editor. Then create a new conditional column.