cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jstern1 Frequent Visitor
Frequent Visitor

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?

 

Capture.PNG

 

Thanks!   

1 ACCEPTED SOLUTION

Accepted Solutions
jstern1 Frequent Visitor
Frequent Visitor

Re: Filter Costs by Region, or Update Query Data with Proper Costs Column

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.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Filter Costs by Region, or Update Query Data with Proper Costs Column

Hi @jstern1 ,

 

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.

 

jstern1 Frequent Visitor
Frequent Visitor

Re: Filter Costs by Region, or Update Query Data with Proper Costs Column

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!

jstern1 Frequent Visitor
Frequent Visitor

Re: Filter Costs by Region, or Update Query Data with Proper Costs Column

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.

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 173 members 1,824 guests
Please welcome our newest community members: