Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have two sets of data ("Transactions Table", and "Costs Table"). I want to be able to add a column to the "Transactions Table" to reflec the processing cost of that particular transaction. The cost is determined by the transaction type, which is listed in the "Transactions Table" - of which there are two types (A & B). The base cost for each type is held in the "Cost Table".
The structure of "Cost Table" has the transaction types (A & B) as row headers, with Row 1 reflecting the respective costs.
Simple example of the table structures:
Simple representation of the two tables
I attempted to merge the "Costs Table" into the "Transactions Table" using the full outer join function, but that resulted in the joined columns reflecting null values. My intension was then to perform an IF statement calculation where if 'Transactions Table'[Type] = "A", 'Costs Table'[A],'Costs Table[B]'. However this plan didn't work and now I'm a little stuck.
Does anyone have any ideas as to how I can go about building this in Query Editor?
Thanks
Solved! Go to Solution.
Hi @G_Whit-UK
You can Unpivot Columns A and B, and later Merge Queries, please see the attached for ref
Hi @G_Whit-UK ,
Is this what you want to get?
If yes, maybe you can do like this:
1. Unpivot all columns in "Cost table":
The you can get this:
2. Merge the wables by "Inner":
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @G_Whit-UK
You can Unpivot Columns A and B, and later Merge Queries, please see the attached for ref
Hi @Mariusz
Thanks for the tip, however the proposed method only partially solves my situation. I never mentioned in my original post that the "Costs Table" has two additional columns ("C" & "D") which both reflect a daily transaction cost. I need to be able to bring these daily costs into the "Transactions Table" where I can then multiple the daily costs by the number of days the transaction was active for.
I could use your proposed solution by adding two temporary columns to the Transactions Table and give the value of "C" and "D" for each row under the respective column, and then perform the merge, however I'm wondering if there is an alternative way to acheive the same outcome?
Thanks.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
71 | |
56 | |
39 | |
35 |
User | Count |
---|---|
66 | |
66 | |
59 | |
53 | |
45 |