I am having trouble figuring out an index function. My datasheet is as follows
Tab 1 - complete list of all subcompanies held by all holding companies
- The first column shows holding companies
- the second column shows the subcompanies held by each holding company
- the third, fourth and fifth column give the key financials of these subcompanies (EBITDA)
The tabs after Tab 1 are tabs for every holding company. In these tabs I have a section where I want to only include the subcompanies from Tab 1 with an EBITDA higher than 20 million
Example:
Holding company A has the following subcompanies: Sub1 (EBITDA:10m), Sub2 (EBITDA: 21m), Sub3 (EBITDA: 15m).
In the tab of company A I want to only display the information of Sub2 as it meets the minimum threshold
The function I have now displays all information of each subcompany per holding company regardless of their EBITDA:
=IFERROR(INDEX(Tab1!D$5:D$337,SMALL(IF(Tab1!$C$5:$C$337=$C$6,ROW(Tab1!D$5:D$337)-MIN(ROW(Tab1!D$5:D$337))+1),ROWS(B$55:B55))),"")
Tab1 Column D has all the subcompany names
Tab1 Column C has all holding company names
Column B is where I insert the subcompanies in the holding company tab
The output provides all subcompanies per holding, but I only want the subcompanies per holding with an EBITDA equal or larger than 20m
How can I add a criteria to filter if one or more of the 3 years worth of EBITDAs (Tab1 Column N, O & P) per subcompany is equal or larger than 20m?
Many thanks in advance!
Change the criteria in the IF statement from:
Tab1!$C$5:$C$337=$C$6
to also check columns N, O or P being over 20m:
(Tab1!$C$5:$C$337=$C$6)*((Tab1!$N$5:$N$337>20000000)+(Tab1!$O$5:$O$337>20000000)+(Tab1!$P$5:$P$337>20000000))
You are using a FormulaArray, however, you could also use this standard formula (entered at B6):
= IFERROR( INDEX( 'Tab1'!$D$5:$D$337,
AGGREGATE( 15, 6, ROW(B:B) /
( ( 'Tab1'!$C$5:$C$337 = $C$6 ) *
( ( 'Tab1'!$N$5:$N$337 > 20 ) + ( 'Tab1'!$O$5:$O$337 > 20 ) + ( 'Tab1'!$P$5:$P$337 > 20 ) <> 0 ) ),
ROWS( B$5:B5 ) ) ), "" )
Related
I have a matrix between Products and Enablers, where the intersection between the two represents a point in time.
Product list
Enabler 1
Enabler 2
Enabler 3
Product 1
10-Oct
11-Oct
20-Oct
Product 2
20-Nov
25-Nov
01-Dec
Product 3
10-Oct
21-Oct
25-Oct
I need to turn this into a 'timeline' view so visually there are two ways to see the data, where the dates are across the top and based on the timing in the first table, it returns the corresponding 'Enabler' at the correct date...something like
Product list
10-Oct
11-Oct
12-Oct
Product 1
Enabler 1
Enabler 2
Product 2
Product 3
Enabler 1
Does anyone have any ideas how I'd do this? I think it requires an INDEX MATCH array formula as it needs to look across the matrix to find the date in that row, then return what is in the header column...but this isn't my area of expertise and I just can't seem to figure out how to make it work.
One approach might be to return this as an array. You could do:
=IF( ( Table1[[Enabler 1]:[Enabler 3]] = B7:D7 ) * ( Table1[Product list] = A8:A10),
Table1[[#Headers],[Enabler 1]:[Enabler 3]],
"" )
where Table1 is an Excel Table that holds your Product List and Enablers as columns (as shown in your first table); A8:A10 is the list of products in your second table; and B7:D7 is the list of dates in your second table shown as column headers. The formula would be placed in the upper left cell of your second table - in my example, B8 as shown here:
The result will spill into the second table.
If you wanted your second table to be an Excel Table, the approach
would be different as arrays cannot spill into Excel Tables.
So I have the following pivot table report through my data model. I want my measure 'Branches
Per Cluster' to consider the current column of month or year.
I have the following tables aside from a generated calendar table, these two below are related by 'CODE'.
A dim table named 'Branch Profiles'
CODE
AREA
CLUSTER
DATE OPENED
AAA
Area 1
Cluster 1
01/05/1990
AAB
Area 1
Cluster 1
05/03/2022
ABA
Area 2
Cluster 1
01/03/2005
BAA
Area 3
Cluster 2
01/03/2024
A fact table named 'BasicData'
CODE
Volume
Value
Date
AAA
1000
10000
06/01/1990
AAB
2000
20000
06/01/2020
ABA
3000
30000
06/01/2005
BAA
4000
40000
06/01/2008
This is what I currently have for my Branches Per Cluster measure which might be obvious for experienced users that is syntactically wrong though I believe it shows what I was trying to do as
I'm not quite sure how to reference the column as a filter. Basically, I just want to count the Branches ("CODE") for the specific area that have a date opened before the month specified by the column filters.
=CALCULATE(
DISTINCTCOUNT('Branch Profiles'[CODE]),
ALLEXCEPT('Branch Profiles',
'Branch Profiles'[AREA],
'Branch Profiles'[CODE]
),
YEAR('Branch Profiles'[DATE STARTED]) <= 'Calendar'[Year],
MONTH('Branch Profiles'[DATE STARTED]) <= 'Calendar'[Month Number]
)
Here is the proper code for the Measure that I was trying to accomplished. What I was missing earlier was a way to reference the current value of the Year and Month columns (Context Filters) and use it as a criteria on the [Date Started] column to get the count on [CODES] that are opened on or before currently specified Month or Year.
If this was done in PowerBI the solution would have involved the function named "SELECTEDVALUE" however, the logic can still be implemented in Excel through the longer syntax shown below in my measure.
VAR cur_year =
IF (
HASONEVALUE('Calendar'[Year]),
VALUES('Calendar'[YEAR])
)
VAR cur_month =
IF (
HASONEVALUE('Calendar'[Month]),
VALUES('Calendar'[Month Number])
)
RETURN
IF(
NOT ISBLANK([Send Volume]),
CALCULATE(
DISTINCTCOUNT(Branch Profiles[CODE]),
ALLEXCEPT('Branch Profiles',
'Branch Profiles'[AREA],
'Branch Profiles'[CODE]
),
'Branch Profiles'[DATE STARTED] < DATE(cur_year, cur_month + 1, 1)
)
)
I have 2 tables and need to use criteria from table1 (Team) to look up information from Schedule2 (Team's Schedule for the year) and then use that array from Schedule2 to find the matches in table1 (opponents) and pair that with the criteria of matching the position within table 1 (position = position) to then sum up the associated numbers that match (2021 opp position points) to calculate the expected total points for the year.
In English: use the team to look up the schedule, use the schedule to look up the array of opponents the team has for the year, use the array of opponents for the year to find the opponents in table1, and then match the position of the current row to the position that is playing each of those opponents, and then sum up the associated points.
Goal: This is to calculate a forecast of each team's position's total points for the year based on how many points their opponents for the year are currently giving away to each position.
Explained Example: So if Dallas WR plays NYG, MIA, WAS, and MIA again, sum up the total points NYG, MIA, WAS, and MIA are currently giving to WRs they are currently play against.
FYI WR = Wide Receiver RB = Running Back, TE = Tight End D/ST = Defense string, QB = Quarterback
I can't use helper cells and need a single formula. Schedule2 will give duplicate values (Some teams play the same team twice and each of those values need to be calculated and not considered unique and not counted just once.
The current formula I have is below but it only seemed to work for one row and didnt work when I drug it down to the row below. could be a referencing issue but I didnt notice anything that would cause this.
The first part of the formula is meant to get the total for the non-duplicated values and the second is meant to get the duplicated values.
= SUM( IF( ISERROR( MATCH( Table1[[#All],[Position]],G14,0)
* MATCH(Table1[[#All],[Opponent]],INDEX(Schedule2,0,MATCH(Table1[#Team],Schedules!$AU$3:$CA$3,0)),0) ),
0,
Table1[[#All],[2021 Opp Position]]))
+ SUM( IF( ISERROR( MATCH( Table1[[#All],[Opponent]],
IF( COUNTIF( INDEX( Schedule2, 0, MATCH(Table1[#Team],Schedules!$AU$3:$CA$3,0) ), INDEX(Schedule2,0,MATCH(Table1[#Team],Schedules!$AU$3:$CA$3,0)))=2,
INDEX(Schedule2,0,MATCH(Table1[#Team],Schedules!$AU$3:$CA$3,0)),
""), 0 )
* MATCH(Table1[[#All],[Position]],G14,0)
* MATCH(Table1[[#All],[Opponent]],INDEX( Schedule2,
0,
MATCH(Table1[#Team],Schedules!$AU$3:$CA$3,0) ),0) ),
0,
Table1[[#All],[2021 Opp Position]] ) )
I have a table within PowerPivot currently that tracks a count of customers through our sales pipeline. From (by sales location) first interaction to charged sale. So far, I’ve creates a moving 5-day average that averages each task. Below is the DAX formula I’ve created thus far and an example table.
=
CALCULATE (
SUM ( [Daily Count] ),
DATESINPERIOD ( Table1[Date], LASTDATE ( Table1[Date] ), -7, DAY ),
ALLEXCEPT ( Table1, Table1[Sales Location], Table1[Group] )
)
/ 5
Where I’m struggling is being able to come up with a way to exclude weekends and company observed holidays. Additionally, if a holiday falls on a weekday I would like to remove that from the average and go back an additional day (to smooth the trend).
For example, on 11/26/18 (the Monday after Thanksgiving and Black Friday) I would like to average the five business days previous (11/26/18, 11/21-11/19, and 11/16). In the example above, the moving total and average for the previous 5 days should be Intake = 41 (total) 8.2 (average), Appointment = 30 (total) 6 (average), and Sale = 13 (total) and 2.6 (average).
Based on the formula currently, each of these numbers is inaccurate. Is there an easy way to exclude these days?
Side note: I’ve created an ancillary table with all holidays that is related to the sales data that I have.
Thank you for the help!
For this, I'd recommend using a calendar table related to Table1 on the Date column that also has a column IsWorkday with 1 if that day is a workday and 0 otherwise.
Once you have that set up, you can write a measure like this:
Moving Avg =
VAR Last5Workdays =
SELECTCOLUMNS (
TOPN (
5,
FILTER (
DateTable,
DateTable[Date] <= EARLIER ( Table1[Date] )
&& DateTable[IsWorkday] = 1
),
DateTable[Date], DESC
),
"Workday", DateTable[Date]
)
RETURN
CALCULATE (
SUM ( Table1[Daily Count] ),
Table1[Date] IN Last5Workdays
ALLEXCEPT ( Table1, Table1[Sales Location], Table1[Group] ),
)
/ 5
The TOPN function here returns the top 5 rows of the DateTable where each row must be a workday that is less than or equal to the date in your current Table1 row (the EARLIER function refers to the earlier row context that defines the current row).
I then use SELECTCOLUMNS to turn this table into a list by selecting a single column (which I've named Workday). From there, it's basically your measure with the date filter changed a bit.
#alexisolson Thank you for the response here. I was actually able to figure this out over the weekend but forgot to close out the thread (sorry about that! Appreciate your help either way). But I did something fairly similar to what you mentioned above.
I created a date table (CorpCalendar) that was only inclusive of working days. Then I created an index column within the CorpCalendar table to give each row a unique number in ascending order. From there, I linked the CorpCalendar table to my SalesData table by related dates and used the LOOKUPVALUE function to bring the index value over from the CorpCalendar table to the SalesData table. In a separate column I subtracted 4 from the date index value to get an index adjustment column (for a range of five days from the actual date index and the adjustment...if that makes sense). I then added an additional LOOKUPVALUE helper column to match the adjusted date index column to the appropriate working day.Lastly, I then used the following function to get the 5 day rolling average.
=CALCULATE(sum(Combined[Daily Count]),DATESBETWEEN(Combined[Date - Adjusted],Combined[Date - Adjusted (-5)],Combined[Date - Adjusted]),ALLEXCEPT(Combined,Combined[Group]))/5
This is probably more convoluted than necessary, however, it got me to the answer I was looking for. Let me know if this makes sense and if you have any suggestions for future scenarios like this.
Thanks again!
I want to make a macro in Excel that summarizes data from rows that match a composite ID generated from 2 ID columns. In my excel sheet, each row has 2 main ID columns: ID_1 is the main key, and ID_2 is a secondary key from which I only care about the first 2 letters (Which I have gotten using LEFT). I want to group rows with the same ID_1 and first 2 letters of ID_2 and report the SUM of the value, count, and sum columns.
In the example picture below, I want to turn the data in columns A:J into the data in columns M:V
So, with this example -> We have 6 records 1015 (ID_1) with 3 different ID_2 (AB, AZ, AE). I want to sum them up to a one cell each (1015 AB ; 1015 AZ ;1015 AE) with values which each record had (there is 3 records: 1015 AB with VALUE of 2,3,4 so in result I want to get just one row 1015 AB 9(sum of value) 4(sum of count) 17 (sum of(value * count)). It's important to see that this 17 dosn't come from 9 * 4. It's =sum(I4:I6) (but it may be spread out like in 1200 FF example below! I am still trying to sort them both at one time, but I cant get past it..)
Add a helper column in D to combine the ID_1 and the first 2 characters of ID_2. =A4 & LEFT(C4,2). Copy that down then go to L4 and type in:
=+INDEX($D$4:$D$25,MATCH(0,COUNTIF(L$3:L3,$D$4:$D$25),0)
and hold down Ctrl + Shift + Enter to make it an array function. Copy down to get a list of unique combinations, and then split these values into the separate columns.
Finally to pull in the numbers, put this in Q4:
=SUMIFS(E$4:E$25,$A$4:$A$25,M4,$C$4:$C$25,O4 & "*")
and then copy down and across.