Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello everybody,
I'm new to PowerBI and have a question about creating a query / formula that can calculate a value from cells of different tables.
I have a table called 'Werkzaamheden' and a table called 'Kosten' These are shown below:
Werkzaamheden
Kosten
Now. I want to create a query / formula that calculates, for each row in the Werkzaamheden table, what the multiplied costs are.
This should be done as follows:
Werkzaamheden[Duur] * (Kosten[Prijs] from the row at which Kosten[Functie] is equal to Werkzaamheden[Functie])
Can anybody help me with this? I can't seem to figure it out...
Solved! Go to Solution.
I think you are trying to create a MEASURE (meetwaarde), you should create a COLUMN (kolom). Add the column to the [Werkzaamheden] table and not the [Kosten] table. I just tried and it worked 🙂
As jthomso mentioned, If you create a link between the two Functie columns, you can add a calculated column to the Werkzaamheden table:
KostenWerkzaamheden = Werkzaamheden[Duur] * RELATED(Kosten[Kosten])
That one should work 🙂
I've tried adding a column to the table 'Werkzaamheden', but got an error:
Expression.Error: The name RELATED hasn't been recognized.
= Table.AddColumn(#"Type gewijzigd", "KostenWerkzaamheden", each Werkzaamheden[Duur] * RELATED(Kosten[Kosten]))
I don't know what I'm doing wrong?
Are you using PowerBI Desktop? Looks like your adding the column in the wrong place (the query editor instead of in the table). Check out this video about how to add a calculated column to a table:
https://www.youtube.com/watch?v=62mLfiNcqVM
Yes, I am using the PowerBI Desktop
I've tried this first, but then I got a notification that no single value for Werkzaamheden[Duur] could be selected.
(Sorry, language is set to Dutch in PowerBI)
I think you are trying to create a MEASURE (meetwaarde), you should create a COLUMN (kolom). Add the column to the [Werkzaamheden] table and not the [Kosten] table. I just tried and it worked 🙂
Thanks so much! It works!
Shouldn't be much wrong with your formula as it is assuming your two tables are related on the Functie column, you may need to use RELATED to pull through your Prijs value
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |