PowerBI: Multiply total with %share in another table - powerbi

I have a measure that calculates the total for a certain account number among numerous accounts: Total EUR Account1 = CALCULATE('GL '[Total EUR], Account[Account number]="1") and then put in a table to show cost per financial quarter:
Table 1
Also; an example of source data:
Source data
Now, this sum per quarter I want to split into four different categories based on another table:
Table 2
So I want to get the below table where the % share per Category and FQ has been multiplied by the total for the applicable FQ.
I do not have the categories in the source data for the main table (Table 1)
Table 3

Related

DAX Measure Calculation Two Different Tables

I have one question about DAX calculation?
Hi Guys,
I have one question about DAX Measure Calculation
Please Help me get the solution of this problem
I have 2 tables
table 1 - Purchase Info
(Column name - Customer ID, Product ID, Quantity, Payment Mode)
table 2 - Product Info
(Column name - Product ID, Product Name, Product Cost, Selling Cost, Tax Amount)
My Question Is, How to Calculate Total Revenue?
The Table 1 (Purchase Info) have repeated customers and more than 10 thousand of records and also records are shuffled. The table 2 (Product Info) have only 10 products and unique records ( Product ID). How to calculate the total revenue.
This will work if you linked your tables via Product ID.
SUMX(
Prod
,CALCULATE(SUMX(Sales,Sales[Quantity]))*Prod[Selling Cost]
)

DAX TopN Behavior

Just wanted to confirm my understanding (or lack thereof) around these two formulas - in an orders table where each row is an order:
TOPN(10,ALL(Orders),[Total Sales]) - looks at the individual Sales amount for each row and returns the whole table with just the top 10 records sorted by the Sales field; using the measure Total Sales(defined as Sum of Sales) in this context doesn't really have an effect as the aggregation is at a single row level which just keeps it the same.
TOPN(10,ALL(Orders[Customer Name]),[Total Sales]) - this actually groups by the customer name, calculates the total sales, and returns the top 10 customer names based on that metric; it's more or less equivalent to this SQL:
select customer_name, sum(sales) as Total_Sales from orders
group by customer_name
order by Total_Sales desc
limit 10

Power BI How to Sum Matched 2 Columns

I have two tables. First one represents sales values of company by department, product ID and month. Second table contains sales target by department and month. I want to add a column to second table. It should shows sum of values from table 1 with grouping department and month.
For Example:
For 310101 in Februray sum of values is 110. So, the first row of table 2 should be 110.
Can you please help me with this DAX function?
Create a calculated column in both tables which will represent an unique ID (Eg: ID = Table1[Dpt ID] & Table1[Month]) and join the both tables by this ID field to create a relationship between these 2 tables.
Now, select all the columns from Table 2 and also select Value column from Table 1. You should get the sum by department.

Power BI Calculate MAX based on the Slicer Selections

I have a table which displays hourly pay per position. I'm using MAX(HourlyPay) to get the maximum value in the table and get a value 60 for example. But when I apply a slicer (based on department), the value still show's as 60. Is there a way to recalculate the MAX of HourlyRate based on the Slicers?
Tables:
Occupants
PayDetails (table which contains "Hourly Pay")
OrgStructure (table containing Department slicer)
Relationships:
Occupants to PayDetails (1:1)
Occupants to OrgStructure (*:1)
The column MAX(HourlyPay) which I'm trying to calculate is in the table Occupants.
This should work. Providing the relationship that you have added links to an identical value in each table, then the slicer should filter the hourly pay column as expected.

Creating a column with lookup from another table

I have a table of sales from multiple stores with the value of sales in dollars and the date and the corresponding store.
In another table I have the store name and the expected sales amount of each store.
I want to create a column in the main first table that evaluates the efficiency of sales based on the other table..
In other words, if store B made 500 sales today, I want to check with lookup table to see the target then use it to divide and obtain the efficiency then graph the efficiency of each store.
Thanks.
I tried creating some measures and columns but stuck with circular dependencies
I expect to add one column to my main table to an integer 0 to 100 showing the efficiency.
You can merge the two tables. In the query editor go to Merge Querires > Merge Query As New. Chose your relationship (match it by the column StoreName) and merge the two tables. You will get something like this (just a few of your sample data):
StoreName ActualSaleAmount ExpectedAmount
a 500 3000
a 450 3000
b 370 3500
c 400 5000
Now you can add a calculated column with your efficency:
StoreName ActualSaleAmount ExpectedAmount Efficency
a 500 3000 500/3000
a 450 3000 450/3000
b 370 3500 370/3500
c 400 5000 400/5000
This would be:
Efficency = [ActualSaleAmount] / [ExpectedAmount]