PowerBI - Lookup by Multiple Criteria - dax

I'm a new PBI user and would like help on the following:
I have 2 tables (Table 1 & 2). Table 1 is a bookings report showing sales orders, part numbers and order value. Table 2 is a margin report showing sales orders, part numbers with additional descriptive text and margin value.
I would like to copy margin values from Table 2 into a new column in Table 1 by looking up by sales order and part number.
Any help would be appreciated!
Tables1

Extract text using the LEFT function
Use the COMBINEVALUES function to create new column in each table. The new column will merge two existing old columns.
Depending if you have unique values in the lookup table, use LOOKUPVALUE function, if not, use this approach: DAX lookup first non blank value in unrelated table

Related

Using DAX to get a table from nested table

In powerBI, I using the python script and generate one table. The generated table is a nested table. Each row value is actually a table. and so now I want to use DAX to copy one specific row value(which is a table), just the "dataset_filtered" table shown as below.
what's the DAX code for this ? or any good suggestions ?
The nested table
This is M rather than DAX.
Click the drop down arrow in the name column to filter the row you want.
Click the expand arrows in the Value column to expand the table.

Hi there, I'm using Oracle. I want to create a view where in this view, I display the rows of the same primary key and the total number of coin sales

There's a couple of tables that I need to use columns from in the select statement. the questions is: Create a View to display the employee id, first name and surname. In your query include the coin price and a 10% commission for the sales made by the employees.
the difficult part for me is that employees of the same employee number, can make multiple coin sales, so in the view, i need to be able to add all the coin sales together of each respective primary key (employee_id)
As you can see in this image, emp101 has sold two different coins, with the coin_id's of "7116" and "7112". In the view i want to be able to somehow tally each coin value that each employee_id has sold if that makes sense ?
There's multiple other tables, but there's too many to send, so i am just trying to get a general idea of how to do this. I understand the logistics of the question, i just dont know how to implement the answer with the correct syntax and methods etc...
Since this appears to be a homework question, here is a discussion of how to solve it:
You want to CREATE a VIEW and give the view a name (something like employee_commisions) and include 5 columns (employee_id, first_name, surname, coin_price and commission - or maybe only 4 columns if they want the combined price plus commission).
To get the values for that view, you want to SELECT ... FROM existing tables; however, your image does not include first_name, surname or a value for a coin so I am assuming that you will have an employees table and a coins table that you will need to INNER JOIN to the invoice table on their respective primary keys.
To get the total value for the coins, you want to aggregate the values and this would be done with the SUM aggregation function and, so that you get the value for each employee, you would need to GROUP BY the employee_id primary key. You will either need to include the other columns you are not aggregating by in the GROUP BY clause or apply an aggregation function to those columns such as MAX(surname).
The syntax for CREATE VIEW is here.
The syntax for SELECT is here.

Sorting results based on current year sales in multi-year table and creating rank column SSRS

I am newish to SSRS and I am trying to create a report where where each row displays sales for the selected year and the previous 2 years in separate columns. I would like to sort the results by the current year's sales and create a rank column and create a parameter allowing the user to choose the top N rows they wish to display. I see the tablix sorting tab which allows you to select an expression to sort by, but how would I specify that I want to sort by the sales for one year specifically? Or would I go about this by creating the rank column by that expression first then sorting the table by that rank column?
UPDATE: It is a SQL Server database and I can edit the SQL. For the columns I have storeID, storeName, Year, and Sales.

Result always on the bases of fix column qlikview expression

I have a table in that table there is ID column .. i want the result on the bases of that ID column .. when that ID column removed with the another dimension then result be should be same on the bases of ID column .. this is expression what i tried
Aggr(rangemin(sum({<FO={'out'}>}claim),500),ID)
but this shows that when i replace another dimension with ID column figures is changed..
so how i fix this expression on the bases of ID dimension
any help
UPDATE
this is the link of test file
https://www.dropbox.com/s/p3nyy6h7iybrctu/test_id.rar?dl=0
in this test file i want data on the bases of ID in second table

Custom column to sum values from second table with conditional statement

I have two tables, the first table has a list of invoice numbers and the second table has a list of products associated with each invoice. I want to sum the total cost of the products for each invoice and include it in the first table using Excel Power Query.
Table 1
[InvoiceNumbers] [OtherData]
Table 2
[Product] [Amount] [InvoiceNumber]
List.Sum() seems to be the function I need to use, but I cannot filter table 2 by invoice number using this function
Table.SelectRows() can be used to select the second table, and filter it to a specific set of rows, but I cannot seem to filter the rows of Table 2 using a column from Table 1.
I have also looked into Grouping and joining the table, but because of other factors I have left out, this is not going to work.
The full query Im working with looks like this.
List.Sum(Table.SelectRows(Table2, each [InvoiceNumber] = [InvoiceNumber])[Amount])
This just returns the sum of all the rows because [InvoiceNumber] is equal to itself.
How can I reference the Invoice Number of the row in Table 1 to use it as a condition in the Table.SelectRows() function? Or is there a better way to get the data sum the from Table 2?
Table 1 Final
[InvoiceNumber] [OtherData] [SumOfAmounts]
If there is a restriction to group the invoice details table, you could just reference it, and group the reference
1) Reference the table:
2) Group the referenced table:
3) Then merge the reference table and expand the total column
If this helps please remember to mark the answer

Resources