Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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?
Thanks!
Solved! Go to Solution.
HI @Anonymous ,
Power bi not suitable to calculate across multiple fields, I'd like to suggest you enter the query editor and use unpivot columns feature to convert these cost fields to attribute and value.
Unpivot columns (Power Query)
After these steps, you can simple filter on region attribute or write formula to calculate based on current category group.
Regards,
Xiaoxin Sheng
Hi @Anonymous ,
Please share some sample data with expect result to help us clarify your requirement and do test to coding formula.
Regards,
Xiaoxin Sheng
Hi v-shex,
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!
HI @Anonymous ,
Power bi not suitable to calculate across multiple fields, I'd like to suggest you enter the query editor and use unpivot columns feature to convert these cost fields to attribute and value.
Unpivot columns (Power Query)
After these steps, you can simple filter on region attribute or write formula to calculate based on current category group.
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
88 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |