Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello everyone,
I have a table as per below screenshot. The table is about the costs of three types of products (pizza, pasta and Cola Cola).
I want to have the total costs for all three products by month. However, for Pizza and Pasta, there are only the sub-components for the total costs (Production + Marketing + Branch Store), and for Coca Cola there is already total costs which do not need to do a sum.
In the end I want to show the total costs for Pizza and Pasta as well, then using the total costs to do some analysis; if possible I would also like to keep it's sub-components, so I can create some pie-chart to connect with other charts.
Do you know how this can be done on Power BI?
Thank you very much in advance!
Solved! Go to Solution.
@Clementw66666 , You can use UNPIVOT in power query then
In Power BI, go to the "Modeling" tab and create a new calculated column using the following DAX formula:
Total Costs =
IF(
'Table'[Type] = "Total Costs",
'Table'[Value],
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[Category] = EARLIER('Table'[Category]) &&
'Table'[Date] = EARLIER('Table'[Date])
)
)
)
Total Costs by Month: Use a line chart or bar chart to show the total costs for each product by month.
Sub-Components Breakdown: Use a pie chart to show the breakdown of sub-components for Pizza and Pasta.
Proud to be a Super User! |
|
@Clementw66666 , You can use UNPIVOT in power query then
In Power BI, go to the "Modeling" tab and create a new calculated column using the following DAX formula:
Total Costs =
IF(
'Table'[Type] = "Total Costs",
'Table'[Value],
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[Category] = EARLIER('Table'[Category]) &&
'Table'[Date] = EARLIER('Table'[Date])
)
)
)
Total Costs by Month: Use a line chart or bar chart to show the total costs for each product by month.
Sub-Components Breakdown: Use a pie chart to show the breakdown of sub-components for Pizza and Pasta.
Proud to be a Super User! |
|
Thank you very much!! It works.
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 |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |