Virtual array to be used into VLOOKUP and SUMIF formulas - vlookup

I have the following tables
In Table 1 I have some items with relative quantity values. Beneath, I have a look-up table from which I can find the rule for summing up the item's quantities into the right Container.
Currently I use additional columns, one for each Container, for helping in succeding the task.
Each cell in additional columns has the following formula (ex. E4):
=IF(VLOOKUP($B4,$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0)
Then, each Container has a Sum of Values calculated as follow (ex. E3):
=SUMPRODUCT($C$4:$C$9,E$4:E$9)
The question is... Is there a way (no VBA) to obtain the same result without using additional helping columns?
I would like using something like this as formula (but it doesn't work):
=SUMPRODUCT($C$4:$C$9,IF(VLOOKUP($B4:$B9,$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0))
In short, I don't know if (and if yes, how) the helping columns in the sheet I use can be calculated on the fly from excel as virtual columns directly into a cell formula.
No limitations in the use of VLOOkUP and SUMIF functions -> SUMIF, SUMIFS, INDEX, MATCH and any other combination of Excel functions is fine as long as the goal of eliminating the help columns is achieved.
Any help on this would be really appreciated.
Thanks in advance to everyone

Try,
In E3, modified your formula and copied across right to G3 :
=SUMPRODUCT($C$4:$C$9,IF(VLOOKUP(T(IF({1},$B4:$B9)),$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0))
Or,
=SUMPRODUCT($C$4:$C$9*(VLOOKUP(T(IF({1},$B4:$B9)),$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x"))

Related

Converting a Tableau report with different measures for each row to Power BI

I'm working on a project where we are converting a client from Tableau to PBI. One of the Tableau reports I'm converting looks like this:
Each row is a different calculation (measure). I can achieve a similar look, with regards to the column headers, in PBI by using a matrix. However, there isn't a way, that I know of, to apply a different measure for each row. The only way I can think of to do this is to create three matrix tables and stack them on top of each other. It won't look nearly as good but I can generate the same results. Does anyone have a better solution?
Put the Measure Names pill on Rows, Measure Values on Text and your date fields on Columns. That should give you when you want.

Power-BI: Add column in Data-Area or Add Column in Power-Query

I am wondering where the difference in both approaches lie.
Basically I want to add a column which indicates as a result with TRUE or FALSE if a data row is inside my time period I have to consider (all values older than current calender week - 1).
For my understanding I have two options:
Option 1:
I modify my data query and add a new column with a formula like this in Power-Query:
DATEDIFF(WEEKNUM([created].[Date]),WEEKNUM(TODAY()),WEEK)
Option 2:
I use the Data-Section in Power-BI and add a column wiht this formula:
DATEDIFF(WEEKNUM([created].[Date]),WEEKNUM(TODAY()),WEEK)
What is the difference of both approaches, using either the backend PowerQuery vs the Data-Section in Power-BI. Is one more favourable?
Common answer in PowerPivot world suggests calculated columns are very costly, therefore better to choose PowerQuery to do the data preparation work. I suppose it depends on how many rows you have and how many other calculations you are asking PP/DAX to do as you are now storing a value that can be easily calculated.
Independent of "cost", I tend to use DAX for dynamic calculations and land more static values using PQ/M which allows for some very creative extract/transform/load (ETL). Think of it this way: if you put the formula in Excel, calculate for 1MM rows it has to recalculate every time you do, well, anything. So what do you do? Use the formula to calc the value then paste values so you just keep the answer. PQ can deliver the final result and drop the calcs or -- better -- intermediate data.
JR

Grouping by multiple columns and aggregating all values

I am rather new to Power Bi and I have a question i can't find the answer to.
I want to import a table that have some label columns, with repeated items, and more than 15 data columns.
My desire result would be to group the label columns, so no repeated items, and aggregate the values of the remaining columns.
Is there a way to do that in PQ editor or DAX ?
I appreciate any help or direction you can give me!
A sample of the table (it's much bigger, with multiple values in the first three columns)
Table Sample
Thanks a lot
Edit: From that sample, the output y I want is the following
Output Sample
The thing is, there are many different values in the first columns, and i need to agreggate all the other values, keeping they column name (cause this info is already linked to other files).
Maybe the only way is to group by and add the columns, renaming them one by one?
I want to do this in a couple of files, so if you know of another way please let me know!
In your query designer import your table. Then go to Home > Group By and group like you want it, the same goes for the aggregations and thats it.
If you just want to remove row duplicates, just group all columns which you dont want to aggregate and the rest can be aggregated like you want it.

Vlookup to compare two tables

IF(ISNA(VLOOKUP(Table1,Table2,1,FALSE)),"No","Yes")
I want compare all the columns for two tables within a single excel sheet and I used the above formula but somehow the formula always gives "Yes" irrespective of whether the values match or not. Can someone please help me out to get correct comparison results.'
Thanks
Please see the snapshot below
Formula will be as below. Kindly take this as example and work out as per your wish.
=IF(VLOOKUP(G1,$A$1:$B$7,2,FALSE)=VLOOKUP(G1,$D$1:$E$7,2,FALSE),"Same","Different")

If function not working across multiple columns and multiple functions nested

I’m having trouble with a function trying to get two cells to "merge"
I have 2 columns, Column D and Column G, both have either a number or #N/A in them. Column D represents package prices shipped with USPS, while Column G represents package prices shipped with FedEx. The only reason #N/A is in some of them is a lack of proper record taking. The function I have written now is as follows:
=IF(D2>0,D2,IF(G2>0,G2,x))
If does the first part fine, but when it gets to the part where I tell it to check column G, it comes up as #N/A.
Maybe this is the wrong route to take, but I'm hoping to have one column with these two columns combined so I can have a separate column next to it with what I actually charged for shipping and compare.
Any help will be greatly appreciated.
Thanks
(Assuming you are working in Excel or a similar tool)
Comparing text using > won't do what you want. "#N/A" > 0 is true. Use the istext() function:
=IF(istext(D2),if(istext(G2),x,G2),D2)