Image of the problem (https://i.stack.imgur.com/Ie0ZV.png)
The IF formula is supposed to give the answer yes if the two values are the same, which they are. Although I get the answer No. Why is this happening?
The two values are themselves formulas from other sheets.
Image of attempt to solve (https://i.stack.imgur.com/qetL3.png)
I tried to use numbers directly put in the same sheet (no numbers coming from a formula), and then it works. But I need to use values that are based on formulas taking numbers from other sheets.
while the values derived from the formulas is just showcasing 2 decimal places, its likely that when you expand/increase the decimals to extreme end there could be a possible difference (alike the one you can see in the screenshot for reference; the EXACT() in Cell B3 throws 'FALSE')
You could ROUND() them up for exact match scenario.
Related
I'm kind of new to DAX and I'm basically learning as I'm using it in my work. We are building reports in PowerBI and we have data model that gets data from Oracle database. So I'm using DAX to create measures in this data model.
I need to substract 2 numbers from each other. So I created simple measure which looked like this:
[MEASURE1] - [MEASURE2]
Whether it works or it doesn't depends on my Period filter which uses another table. I don't know how could period be related to any of this. So when I change filter to some values, I get normal number. However, when I switch it to different values, I get numbers like 2,27483058473905E-13.
Weird thing is that if I check those two measures that I'm subtracting, they have exactly the same numbers, so the difference should be 0.
I know this is not the best explanation, but it is impossible to describe entire data model here. So I'm just looking for some ideas what could possibly be causing this and what should I check.
I have literally no idea what could be causing this.
Floating point precision.
Either use fixed decimal data types, specify the format string of the measure, or wrap your measure in ROUND, e.g.:
Diff =
ROUND (
[Measure 1] - [Measure 2] ,
2
)
2,27483058473905E-13 is not a huge number, but as close as a decimal calculator can get to zero.
I have a table where I need to get the values of the ticked headers as shown. The ALL takes precedence and it will include all headers when ticked.
Here is the working copy of the sheet.,
The expected values are shown in the image below.
The purple cells will have formula, H2, H3 and so for for each row.
I have tried with
=TRANSPOSE(FILTER(Config!A$1:A$16,(INDEX(Config!A$1:G$16,,MATCH(2,Config!$A$1:$1,0) ))=TRUE))
delete H:K range and use in H2:
=INDEX(TRIM(SPLIT(FLATTEN(QUERY(TRANSPOSE(IF(B2:B=TRUE, C1:F1&"♦",
IF(C2:F=TRUE, C1:F1&"♦", ))),,9^9)), "♦")))
Code Guy, see if this formula (need to drag down) does what you want:
=IF(B2,{C$1:F$1},IFERROR(FILTER(C$1:F$1,C2:F2),""))
"Brute-forcing" the solution with IFs kinda works, even though it's inelegant and not scalable to larger number of columns. Might be interesting to re-ask the question with an arbitrary number of columns. Pure formula solution might not be possible.
In Amazon Athena, I want to round a big number to output me as decimal precision 2.
For example, I have 1.4309491454947177E11 which is equivalent to 143094914549.47177, so I expect result to be 143094914549.47
I am doing
SELECT ROUND(1.4309491454947177E11, 2)
But it is giving me wrong output 1.43.
Any help would be much appreciated!!!
The output is correct it is converting it to 2 decimals and you can use it in any downstream. It is just displayed as exponential. Similar to the way you see in excel and when you click on excel cell it displays actual value.
If you want to see data in 2 digit format.Cast will work make sure no of digits in cast is more than actual value
select cast(Round(1.4309491454947177E11 ,2) as decimal(20,2))
I was wondering if anyone could help with the following. I have found one question and answer relating to my query (I think!!) but I can't break it down to do what I want.
I have created a spreadsheet and used the IF & AND functions to do half of what I want.
Basically if the answer is "no" in one column and one of four options in another (111,112,118,119) I want it to bring in the value of C2. This is what I have come up with:
=IF(AND(E2= "No",F2=112),C2,0)
This part works fine but I also need it to bring in the value of C2 if "Yes" (E2) is selected AND the value of D2 is equal to F2 - this is what I have come up with
=IF(AND(E2="No",F2=111),C2,0),IF(E2 ="Yes",D2=F2,C2)
It doesn't work.
I found the answer linked at the top of the post, but my Excel skills aren't up to pulling it apart to fit what I want.
The reason you can't get the formula to work is because there are two separate formula thrown together in a cell:
=IF(AND(E2="No",F2=111),C2,0) - alone this is a complete formula and will return either C2 or 0.
If you want to nest your if statements you need to look at chaining them off each other: If([something],[do this],If([something else],[do this],If(... you get the point.
In terms of what you are trying to achieve there is a more effective method though, by using another formula, MATCH() that returns the position of a match in the list (array or range) you provide. You can just check whether the result of that formula is a number, like so:
=IF(AND(E2="No",ISNUMBER(MATCH(F2,{111,112,118,119}))),C2,0)
EDIT
So instead of providing 0 when the result of the AND() is false, we kick off another if that is your "Yes" clause... This then gives the 0 if it fails... Flip them round if you want "Yes" to be calculated first.
=IF(AND(E2="No",OR(F2=111,F2=112,F2=118,F2=119)),C2,IF(E2="Yes",D2=F2,0))
So the final result based off your comment would have been:
=IF(OR(AND(E2="Yes",D2=F2),AND(E2="No",OR(F2=111,F2=112,F2=118,F2=119))),C2,0)
I'm trying to add a spreadsheet editing function in my iOS app. I am using a gridview to display (not relevant to the question) and I am using LibXL to load the data into the view. That part all works very well but I have no way to calculate the formulas after a cell has been modified.
It appears that when I write a formula with LibXL it is not calculating the new value, just setting the formula value (a string). So when I try to read the number value from that cell it is still set to the last computed number (from excel).
Likewise, if I create cells with numbers and a formula cell to SUM them, it is never actually computed which reads a 0 number value until it's opened in Excel.
I was hoping LibXL was the silver bullet to my problem, but now I'm stuck with just the formula string value (i.e. "SUM(A1:b2)" ) and the last computed value.
I would love it if LibXL simply DID compute values and I just have it all wrong, but I can't see any documentation that says otherwise. If that's not the case are there any Obj-C, C, or C++ libraries that I can use to match the Excel Formula syntax and compute these values?
Just adding my previous comment as an answer:
Dave Delong's DDMathParser has the option to add custom functions, check it out here: http://github.com/davedelong/DDMathParser