I have one Measure which I am using as a denominator in calculating multiple calculated measures. The user typically drags and drops Numerator, denominator and calculation measure to view the report.
It works fine. But now I want to implement suppression rules defined by business. For example: If the calculated % is <=5 then denominator value should be shown as *.
I have used SCOPE statement to handle this. But now I have ended up defining multiple SCOPE statments for single denominator measure. The problem is, as you must have already guessed, the result of one Scope statement is clashing with other scope statements defined for same denominator measure.
For example: Even though denominator is supposed to show actual value for a particular % calculation, it supresses it with * because other % calculation in which the same denominator measure is used returns <=5 value.
My question is: Is it possible to find out, through MDX SCOPE or something like that, which measures are actually in use, or dragged and dropped by user in report?
May be a silly question but please help. Or give me some different perspective to solve this problem.
Thanks,
Parry
To answer the part of your post which says "Is it possible to find out which measures are actually in use?" I suggest this trick: SetToStr(StrToSet("Axis(1)"))
This will get a list of items on rows (or columns) and return it as a string. In a Micrsoft environment you could use InStr() to search this for Measure names, and decide what to do with an IIF(). I hope this gives you a starting point! I have a feeling the MDX could get very long and very messy, hurting your brain.
An easier solution to the "If the calculated % is <=5 then denominator value should be shown as *" problem is to add some code to the DLL which renders the cellset on a webpage. Just detect if you're in the relevant Measure's column, then check the cell's value is <=5 and decide what to output to the user at that point. This might hurt your brain less than the MDX required.
Related
Alright this should be a simple one.
I apologize in case it has been already solved, but I can only find posts related to solving this issue with programming languages and not specifically to EXCEL.
Furthermore, I could find posts that address a sub-problem of my question (e.g. regarding limitation of certain EXCEL functions) and should solve/invalidate my request but maybe, just maybe, there is a workaround.
Problem statement:
I want to calculate the minimum value for each column in an EXCEL matrix. Simply enough, I want to input a 2D array (mxn matrix) in a function and output an array with dimension 1xm where each item is the minimum value MIN(nj) of each nj column.
However, I want to solve this with specific constraints:
Avoid using VBA and other non-function scripting: that I could devise myself;
All in one function: what I want to achieve here is to have one and one function only, not split the problem into multiple passages (such as for example copypasting a MIN() function below each column, that wouldn't do it);
The result should be a transposable array (which is already ok, I assume);
Where I am stranded with my solution so far:
The main issue here is that any function I am trying to use takes the entire matrix as a single array input and would calculate the MIN() of the entire matrix, not each column. My current (not working) function for an exemplary 4x4 matrix in range A1:D4 would be as below (the part in bold is where it is clearly not working):
=MIN(INDEX(A1:D4,SEQUENCE(4,4,1,1)))
which ofc does not work, because INDEX() does probably not "understand" SEQUENCE() as an array of items to take into account. Another, not working, way of solving this is to input a series of ranges (A1:A4;B1:B4;C1:C4;D1:D4) so that INDEX() "understands" the ranges as single columns, but ofc does not know and I do not know sincerely how to formulate that. I could use INDIRECT() in some way to reference the array of ranges, but do not know how and could find a way by searching online.
Fundamental question is: can a function, which works with single arrays, also work with multiple arrays? Basically, I do not know how to communicate an EXCEL array formula, that each batch of data I am inputting is a single array and must be evaluated separately (this is very easily solved with for() cycles, I know).
Many thanks for any suggestion and any workaround, any function and solution works as longs as it fits in the constrains defined above (maybe a LAMBA() function? don't know).
This is ofc a simplification of a way more complex problem (I am trying to calculate the annual mean temperature evolution for a specific location by finding the value - for each year from 1950 to 2021 - that is associated to the lat/lon coordinates that are the nearest to the one of the location inputted, given a netCDF-imported grid of time-arrayed data; the MIN() function is used to selected the nearest location, which is then used, via INDEX() to find temp data). I need to do this in one hit (meaning just pasting the function, which evaluates a matrix of data that is referenced by a fixed range), so that I can just use it modularly for other data sets. I already have a working solution, which is "elegant"* enough, but not "elegant"* as the one I could develop solving this issue.
*where "elegant"= it saves me one click every time for 1000+ datasets when applying the function.
If I understand your problem correct then this should solve it:
=BYCOL(A1:D4,LAMBDA(d,MIN(d)))
I would much appreciate it if someone could help me with the needed formulas for this case.
I have multiple matches that I want to determine their winners based on their score. I also want to do a couple of stats based on the results.
A sample of how the game result should be entered
My requests are:
1- Return winner team name based on the original time result, if a tie then the extra time result, if a tie then penalties result. I also need the winner cell to have no values if no game result is entered.
2- If the game ends in original time, OTC counter increases by 1.
3- If the game ends in extra time, ETC counter increases by 1.
4- If the game ends in penalties, PC counter increases by 1.
I am guessing the counters would be done using the same method but you are the expert here.
Thank you so much for your time and effort.
(This information is too big to fit a comment, hence I put it as an answer)
I don't think you'll get answers on this site, as you have not done any effort yourself. But I have the impression that this is due to the fact that you don't know where to start, so let me give you some starting advice.
The functions you'll need to perform this task are mostly Max(), Sum(), IF(), CountIF() and maybe SumIF() (or CountIFS() and SumIFS() in case of multiple criteria).
As for the finding of the winner, you might use the Max() function in order to find the best result, and use a Lookup() function in order to know where you might encounter that result.
It might be helpful to add a helper column, containing a value (like 1) for all winning teams. By adding all those ones, you might fill the information in your other columns.
Now you have a starting point. Please try this out and if you have any specific questions, feel free to ask.
Thanks to Dominique, This is where I got so far regarding deciding on the match winner.
I used a combination of IF(), MAX() and LOOKUP functions. I am now determining results based on 2 cases: original time and penalties.
This is how the match appears
And this is how my formula looks like to determine the winner
=IF(C12=C13,IF(ISBLANK(D13),"",LOOKUP((MAX(D12,D13)),D12:D13,B12:B13)),IF(ISBLANK(C13),"",LOOKUP((MAX(C12,C13)),C12:C13,B12:B13)))
My issue now is that I want to count for human error when entering the results. With this formula, it returns Team B as the winner if the penalties result is a draw which cannot happen. I need it to show an error or not return an output if the result entered in the penalties score are equal.
Thank you for your support.
I am working on a spreadsheet for a client that calculates values and shows them as fractions after a good amount of deductions. We were running some test after I had it all set and ready and they ran a certain number through the spread sheet. I'll try to beak it down as easily as possible (any value with brackets is user input. So Width is [94.5(94 1/2)] that number get subtracted by 7.5312(7 17/32 that equals 86.9688(86 31/32) that number is then divided by [3] which then equals 28.9896(28 95/96) This is where the problem is though. 95/96 is not a "real" fraction is there a way I can round numbers like this down to 64ths? They were expecting 63/64ths Even though the math is correct they need it to round down in those cases.
The If statement is this:
=IF(E4=1,(K4-F19)/1,IF(E4=2,(K4-G19)/2,IF(E4=3,(K4-H19)/3,IF(E4=4,(K4-I19)/4,IF(E4=5,(K4-J19)/5,IF(E4=6,(K4-K19)/6,IF(E4=7,(K4-L19)/7,IF(E4=8,(K4-M19)/8,IF(E4=9,(K4-N19)/9,IF(E4=10,(K4-O19)/10,0))))))))))
This is a single part of the IF statement:
=IF(E4=1,(K4-F19)/1
Is there a way around this or are they SOL(Sorta Outta Luck)?
Thanks for any insight.
Assuming in A1, please try:
=ROUNDDOWN(A1*64,0)/64
with suitable formatting.
This ensures that all results are multiples of 1/64.
I wrote a user-defined function for fractions to be displayed with superscripted & subscripted digits (available in Unicode), with denominator no more than the user wants to. I could basically turn π into ²²/₇ with "=Fraction(PI(),30)", since no other fraction would be closer to π with a denominator smaller than or equal to 30.
Then I'm thinking of writing an InvFraction function as well, to get from a string generated by the Fraction function into an actual number. As you can imagine, though, the value is not π anymore, but 3.142857... (i.e. ²²/₇). So I'm postponing the writing until I remove that sense of chasing a ghost I'm feeling about it.
I saw that one could make the Fraction function generate a size-2 array of values, then through the index function, let the user decide which one to display, or enter the Fraction function as an array function covering 2 cells. Neither one is ideal from my perspective, the first option because the second value, which could be π, gets lost through the index choice and is no longer retrievable, the second option because it forces two cells to contain the data (though I guess I COULD end up living with it).
I also thought of using user-defined types containing the string value for the fraction and the double value for the original input, but I noticed they don't work in the actual sheet, then informally confirmed the info there: Call VBA function that returns custom type from spreadsheet
Anyone would have any idea at how to tackle this? Thanks anyways for having taken the time to read.
Edit: To put it simply, if I were to program the InvFraction function as I conceived it with the tools and ideas I have, I could only manage to have “=InvFraction(Fraction(PI(),30))” to equal 3.142857... (22 divided by 7), but I would rather like it to generate 3.14159265... (π).
How do I apply following requirement in Saved Search criteria?
Filter all inventory items
Where min( {memberitem.quantityavailable} / {memberquantity} ) <> custitem_quantity
Note: custitem_quantity is a custom numeric field.
Note2: NetSuite is throwing error when I use min function in filters.
There is more than one issue here.
You have to be careful with custom numerics in Netsuite.
When your inner condition evaluates, it does not have the same type because it is fractional. At some point it has to be rounded and / or truncated internally. The other side of the expression would need to call a floor or ceiling function to remove everthing past the decimal.
Also, the min function evaluates after the <> conditional, which will be dependent upon whether your custom numeric is type compatible to begin with.
In the expression you provided us, it would have to be an exact match (and an exact type), and that is before you consider whether MIN gets to be evaluated.
Look at how the datatypes are cast and what columns you are processing because memberitem.quantityavailable may need a secondary index depending upon your dependencies and where the formula is being called. If this formula is being used over multiple products, it may not be logically consistent.
When I have similar items in inventory that I want to generate stats for I try to process it separately, even if I have to make a second pass.
What are you trying to isolate exactly - - I cannot think of a quantity-related situation where there would be a need to use division in this way - - please refer to the formula Mike Robbins listed above for a properly structured evaluation and see if it achieves the desired result.
If you post the rest of your code, I will help you resolve this.
The entire expression is not valid and will not evaluate due to the conditional shown, the MIN, nor the division. Index the count on the memberquantity if you are looking to sum over values. Otherwise, CountIF will work for quantities. MIN will only finds the lowest value in a given column, so SumIF appears to be what you are after. You can create a second expression which bounds the values you are searching for as a preliminary step.
I am new here, so please elaborate on what you are trying to accomplish so I can earn the bounty.
You may want to take into account null values as well to avoid errors or inconsistent data.
If you're using formula numeric, try this:
Formula(Numeric):
case when min((NVL({memberitem.quantityavailable},0) / NVL({memberquantity},0)) - (NVL{custitem_quantity},0)) then 1 else 0 end
'IS EQUAL TO' 1
I believe you can use the Formula Text or Formula Numeric Search Filter for that.