How to select most expensive part per department? - powerbi

I have a table in power BI consisting of 3 different columns: Storage Location, Material, and Extended ( or the cost of each part * the quantity). There are repeating rows for the material and storage location, so I need to find the material with the accumulated highest extended cost for each department and show it in a table.Matrerial Column
Storage Location Column
Extended Total Cost Column

Related

How to add new row to table on PowerBI

So basically, I am trying to edit a dashboard that someone who left my company made. I want to add a row at the end of the upper table in Image 1 that says Gross Profit, which will of course just be Turnover - Cost of Sales.
In fact, a measure with that calculation called "Gross Profit" is already in the fields (see Image 4). When this is checked along with other measures and put in "Values", it produces the lower table (see Image 2). This is what I would like to be seen in the upper table.
Of course, the problem with that is that in the upper table (Image 1), each row is a Group, made up of Lines (See Image 3), and in order to add "Gross Profit" I'd have to create a Calculated Line that calculates Turnover - Sales for every single date. That would take far too much time.
When I do check the Gross Profit measure when on the upper table, it just looks like Image 3, with Gross Profit added as a column total after every Amount.
Is there any easy fix where I can add Gross Profit as a row in the upper table, like how it is in the lower table (Image 2)?
Thanks for reading.

how to Switch off Per row level subtotals dynamically for a Matrix in power bi

We have Matrix where Per row level subtotal is Switched on for only one Row and for rest of the rows its turned off. Its good up to here.
Issue:- When a user adds a new column to the matrix then by default the subtotal is on for the newly added column. is there a way to dynamically turn off for the newly added columns ?
We have to use ISFILTERED of any row context, example I have Date as rows in Matrix, I can use measure for IF(ISFILTERED('Dates'[Date]),sum/values(that new column),blank()).
this means we are restricting the newly added column to only row level data and total
of the matrix is converted to blank value.

Apply drill through to matrix having dynamic axis as its axes in PowerBI

I have a matrix that has a column as a prediction bucket and row is coming from a dynamic axis value. If I drill through to one of the cross-sections of this matrix it shows me all the data falling in the segment of prediction bucket but is not filtering through the dynamic axis value.
For example, I have my rows as tenure bucket and column as prediction bucket and one of its cross-section shows that 8 people fall in that category. I.e., having prediction >75% and have a tenure <3 months. But if I drill through it shows all the people falling in >75% bucket but doesn't filter on the age bucket.
Matrix
Drillthrough
Create a join between all the columns used in Dynamic axis to that table which actually holds those columns.
For eg
Relationship view
as we can see that I have used payment method in the creation of my dynamic axis so I created a relationship from X_AXIS_VALUE to payment method. And it solves my problem.

Power BI: How to get ONLY ONE total for each row in a matrix with multiple dimensions

I have a matrix that has two row's dimensions- one for the country, and one that shows different KPIs. Then I have two dimensions for columns - one with the product name and one with the product logo. Basically all KPI's for each country broken down by product:
What I need to have is a total for each row, e.g. total KPI1 for all products, then total KPI2 for all products and so on.
However, when I go to the formatting tab and turn subtotals to be ON, it appears in this way:
It gives me a total for each product separately which is basically the same number. Is there any way to have only 1 total for the whole row?
Go to Format > Subtotal and turn on Per column level. Then you can specify which levels you want to show subtotals for below that toggle.

Weighted Average Cost across 2 tables power BI

I am looking to calculate a weighted average cost of products that are on 2 separate tables within power BI. One for demand and one for supply. The common factor between the two tables is 'Datetime' that is every half hour period for the next few years. E.g.
Table A (Demand)
Total Value, Total Volume, datetime (half hourly)
Table B (supply)
Total Value, Total Volume, datetime (half hourly)
Within both of these tables, price can be calculated my just doing Value/Volume.
For the weighted average price within one table I have used a measure:
Weighted average price =
sumx(table A, Table A[price] * Table A[Volume]) / sum(table A[Volume])
This seems to give me the correct weighted average price within each table. However if I try and calculate crystalized profit and loss which is the profit and loss between demand and supply (P(d)-P(s))*(supply volume) this doesn't work. I presume this is because sumx isn't smart enough to calculate the P/L for each half hour everyday and then add all these half hour P/L up to get total P/L.