Getting token eof in power query - excel

While trying to use a custom formula to find the sales' bonus for employees, I was using the following formula as it was shown in Microsoft's support video.
Bonus
= IF[Total_Sales]>25000 then [Total_Sales]*0.025 else 0.
However, in the second [Total_Sales], I am getting token eof, and can't apply the formula. Any suggestions as to what should I do?
P.S: I have started to learn about Power Query, and other Macro formulas.

Is that exactly your formula? If so you need to use the proper lower case on the if, and no ending period. Powerquery is case-sensitive
IF[Total_Sales]>25000 then [Total_Sales]*0.025 else 0.
should be
if [Total_Sales]>25000 then [Total_Sales]*0.025 else 0

Related

Avoid #num or #Name? in Sharepoint

I am getting crazy with formulas into a calculated column.
Initially this formula works for me, =
IF(DATEDIF(Today,[Due date],"D")<0,0,DATEDIF(Today,[Due date],"D")),
but unfortunately is not showing negative values only errors(#num, #name?), and I need the value be negative or at least be 0. I could not find too much information and I tried different ways but it looks like sharepoint give a syntax error.
Very Apreciated your help
SharePoint will return an error if the first date is grater than the second date, so you got (#num, #name?).
You could use the following formula to achieve your goal:
=IF(ISERROR(DATEDIF(TODAY(),[Due date],"d")),"0",DATEDIF(TODAY(),[Due date],"d"))
This is my test result:

Excel percentage increase based on formula

I am trying to fill the sell price column in an Excel spreadsheet with the increased values in colors based on the round up columns value (1 to 50 green, 50 to 100 blue, 100 to 150 yellow, 150+ pink).
I've opted for the percentage table because some items can be sold for a lot more than what I have purchased them for, so that's just for my benefit. I am open to any other suggestions and I am new to this whole business thing.
I was using IF in my formula which would work great for using one percentage increase in the formula:
=IF($E27<50,ROUNDUP(I$27,-1))
If I try to enter a second argument like
=IF(OR($E28<50,ROUNDUP(I$28,-1)OR($E28>50,<100,ROUNDUP(J$28,-1))))
I will get an error.
I'm probably using the formulas wrong, I've tried "AND" and a couple other formulas, but I can't find anyone else trying to achieve the same or similar.
So something like this:
=IF($E28<50,ROUNDUP(I$28,-1),IF($E28>50,ROUNDUP(J$28,-1),"Error"))
But not sure what the <100 was for.
Although the problem is not completely clear, I understand that you want to add a formula with nested if statements.
I will recommend you to try nested ifs in parts.
=IF($E27<50,ROUNDUP(I$27,-1),"First if condition is false")
If everything is working as per the requirement then edit that text in the formula to add another if statement.
=IF($E27<50,ROUNDUP(I$27,-1),IF(OR(condition 1, condition 2,more conditions),"value if true","value if false"))
In the second argument provided by you, the arguments of the OR function has not been properly provided. Ensure that all the arguments of an OR function are conditions separated by a comma.
$E28<50 This is a condition so it's ok.
But other arguments are not making sense.
Also, using OR multiple times inside the first OR arguments is not clear.
It would be beneficial if you could provide the basic table and mention the requirement clearly.

Excel functions (IF / AND, etc)

Hey guys, so I need to follow the instructions on the left side of the screen and implement them into the 'Total' column on the right. (From the 'Total sales' column)
As you can see I've put an IF statement there just to test and it's very broken as I'm unsure how to begin.
I need some sort of long IF statement that incorporates those rules.
EG:=IF (E3 >= 3000 AND <= 4999.99, print(E3 *1.25), IF etc etc more rules here.
However it's very wrong and I'm sure its impossible to stack IF statements like that.
The method is not to stack the conditional statements, but to nest them!
An if statement is built in the following format:
=IF(CONDITION, RESULT-IF-TRUE, RESULT-IF-FALSE)
If you were to put another if statement if the first case is false, you could achieve your goal.
For example:
=IF(SALES<3000, BONUS=0, IF(SALES>=3000 AND SALES<5000, BONUS=0.025, IF(...)))
This is a Lookup task.
Since you seem to want to embed the targets and %'s in the formula, you could do if like this
=E3*INDEX({0;0.025;0.075;0.1},MATCH(E3,{0;3000;5000;8000},1))
or if you have a version of Excel that supprts XLookup
=E3*XLOOKUP(E3,{0;3000;5000;8000},{0;0.025;0.075;0.1},,-1,1)
More typically, you'd put the Targets and %'s in a range and lookup into that range

Combining multiple IF-statements into one formula

I am constructing a formula to act as an extra 'control cell' for my excel worksheet.
The if statements in text with the expected result:
If D2=0 and E2=0 and F2=0 =>""
If D2=0 and E2>0 and F2=0 =>"m of m2"
If D2>0 and E2>0 and F2=0 =>"m2 of m3"
If D2>0 and E2>0 and F2>0 =>"m3"
If D2>0 and E2=0 and F2>0 =>"m2"
If D2=0 and E2>0 and F2>0 =>"m2 of m3"
If D2=0 and E2=0 and F2>0 =>"m"
If D2>0 and E2=0 and F2=0 =>"m"
I'll converting this formula to vba afterwards, but my knowledge of vba is pretty limited so I like to start with just the excel formula.
Thanks in advance.
*edit: so far the formula always returns "m3" so it acts like all the cells are >0 even if they are empty/have a 0 value.
Formula so far (it's in dutch so als=if)
=ALS(D3=0&E3=0&F3=0;"";ALS(D3=0&E3>0&F3=0;"m of m2";ALS(D3>0&E3>0&F3=0;"m2 of m3";ALS(D3>0&E3>0&F3>0;"m3";ALS(D3>0&E3=0&F3>0;"m2";ALS(D3=0&E3>0&F3>0;"m2 of m3";ALS(D3=0&E3=0&F3>0;"m";ALS(D3>0&E3=0&F3=0;"m";""))))))))```
One way to interpret your table of results is that the value is equal to 0 or its not. your table does not cover the possibility of of values being less than 0. With this understanding one possible NESTED IF function would be:
=IF(D2=0,IF(E2=0,IF(F2=0,"","m"),IF(F2=0,"m of m2","m2 of m3")),IF(E2=0,IF(F2=0,"m","m2"),IF(F2=0,"m2 of m3","m3")))
Alternatively in excel you could use the CHOOSE function. Since each result is unique and its based based on binary results you could use the following formula to generate an index number from 1 to 8:
1+(F2>0)+(E2>0)*2+(D2>0)*4
Drop that in a CHOOSE function and its much more shorter manageable then nested IF. It could look as follows:
=CHOOSE(1+(F2>0)+(E2>0)*2+(D2>0)*4,"","m","m of m2","m2 of m3","m","m2","m2 of m3","m3")
now not being a VBA guru either, I am not sure how CHOOSE would translate over to VBA. But that would be another question!
UPDATE: ALTERNATE IF function
=IF(AND(D2=0,E2=0,F2=0),"",IF(AND(E2=0,D2<>F2),"m",IF(AND(D2=0,E2>0,F2=0),"m of m2",IF(AND(E2>0,D2<>F2),"m2 of m3",IF(AND(D2>0,E2=0,F2>0),"m2","m3")))))
There are many ways to go through the logic. In this case I was able to group the IF functions by results.

Count and sum unique Values POwer BI

I'm trying to get the sum of Sales with uniuqe Catatery i'm using DAX Formula below
Countoracle = CALCULATE(SUM('Data Source'[Sales) ,DISTINCTCOUNT ('Data Source'[ItemAr]))
getting error
The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column.
You are looking at it the wrong way.
Rather than cramming it into one measure try breaking them into 2 parts.
And please elaborate your question. What is your goal here ?

Resources