The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
Can someone help me with this? I have three tables: Report, Holes and Recipe.
Report:
Report Id:
1
2
3
4
5
6
Holes:
Hole Id Recipe Id Report Id
1 2 1
2 3 1
3 3 1
4 2 1
5 1 2
6 4 2
Recipe:
Recipe Id Preset kg
1 1
2 4
3 2
4 8
I would now need to calculate the summarized Preset kg:s / Report. (In this example the summarized preset kg:s for Report 1 would be 12 (Recipe 2: 2 holes x preset kg 4 = 8 + Recipe 3: 2 holes x preset kg 2 = 4. 8+4=12) and for report 2: 9 (Recipe 1: 1 hole x preset kg 1 = 1 + Recipe 4: 1 hole x preset kg 8 = 9. 1+8=9).
How can I calculate this?
Can there be more than one charging report for a hole? Can there be more than one hole per charging report?
Every report has holes starting from 0, 1, 2, 3, 4. I want to calculate the preset kg:s / report, into a table.
There can be two different holes, with the same number on one report with different recipes (two different lines per report). We do have one column in the Hole-table, that telss which line we are talking about.
yeah, this is too complex of a data model. Beyond my capabilities, sorry.
Thank you, both. Unfortunately I cannot get either suggestion to work. I guess it is because my data is a bit more complicated, than my simplified example. The Recipes-table includes the same Recipe ID many times. Since the same Recipe can be changed, the Recipe-table gets a new row for every time a Recipe is used in a report. Like this:
Recipes-table:
Id Recipe ID Report ID Preset KG
1 1 1 4
2 1 2 4
3 2 2 3
4 2 3 3
To get this to work, I have made another table: SharedDimRecipeId, which takes the Recipe ID from the Holes-table and removes duplicates. Then I have many-to-one relationships from the Recipes-table and the Holes-table to this new SharedDimRecipeID.
Any ideas?
Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
Ok, here is a picture of the actual data model:
And here is my problem explained again:
FactChargingReport:
Report Id:
1
2
3
4
5
6
FactHoleData:
Hole Id Recipe Id Report Id
1 2 1
2 3 1
3 3 1
4 2 1
5 1 2
6 4 2
FactRecipe-table:
Id Recipe ID Report ID Preset KG
1 1 1 1
2 1 2 4
3 2 2 2
4 2 3 8
SharedDimRecipeIdentifier-table
Recipe ID
1
2
3
4
5
I would need to calculate the summarized Preset kg:s / Report. (In this example the summarized preset kg:s for Report 1 would be 12 (Recipe 2: 2 holes x preset kg 4 = 8 + Recipe 3: 2 holes x preset kg 2 = 4. 8+4=12) and for report 2: 9 (Recipe 1: 1 hole x preset kg 1 = 1 + Recipe 4: 1 hole x preset kg 8 = 9. 1+8=9).
What's the rationale behind considering ChargingReports a fact table?
I don´t know if any of the tables are actual Fact tables, since it creates new rows for all of these tables every time you charge a hole.
@sw123 although @lbendlin solution will work and it is a great solution but another approach could be to avoid adding a new column in the Holes table, you can achieve this by using the following measure, and then use this measure in the visualization:
Preset Kg = SUMX ( Holes, RELATED ( Recipe[Preset KG] ) )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
You create a standard data model
Then you pull in the kg value from the Recipes dimension into the Holes fact as a calculated column
kg = related(Recipes[Preset kg])
Then you can let the table visual do the rest of the work