Numbering based on formula - if-statement

I want to display Sl. No. in a column based on a flag field in another column.
If flag is “m”, then the Sl. No corresponding to that item is incremented by 1
If flag is “s”, then the Sl. No is corresponding to that item is indicated as main item number + 0.01
If "h" is encountered, numbering should be restarted.
Presently, I have used =IF(B3="","",IF(B3="m",COUNTIF($B$2:B3,"m"),LOOKUP(10^35,$D$1:D2)+0.01)) in Cell D3.
The formula delivers the sequence of numbering as desired. But, the numbering does not restart (see Cell D17 in image below where it should have been 1.00 instead of 4.00).
Note: As per my requirement, there are blank rows between the rows of "Flag" field as shown.

I used the following formula in Cell C3 =IF(B3="h",0,IF(B3="m",INT(SUM(C2,1)),IF(B3="s",SUM(C2,0.01),IF(OR(B3="",B3="tot"),C2))))
It restarts the numbering of items and sub-items whenever “h” is encountered.

Related

Don't Summarize Option Problem In Power BI

What I Have?
So, I have 4 Columns, First is Date type which will be Axis Value (X- Axis), 3 Decimal Type Value (Values Field) which will represent as Line Chart i.e. 3 Lines inside the chart.
Problem?
When i drag and drop the Decimal Type Value inside the Values Field in Line Chart, it takes as SUM.
I already selected Don't Summarize in Column tools tab with Uncategorised as Data Category.
The problem is when I click the down arrow in the Values Field, it doesn't shows "Don't Summarize" Option.
Now I need my data as it is, no sum no count, nothing.
How Can I achieve that?
There is chance to duplicating the values so you might get more value than the present value. So have to create new table using below DAX then apply to you visual.
DISTINCT(SUMMARIZE(ResellerSales_USD
, DateTime[CalendarYear]
, "Sales Amount (USD)", SUM(ResellerSales_USD[SalesAmount_USD])
)

Remove duplicates values based on multiple column with a condition in query editor Power BI

I am new to power bi and would require your help to sort out below issue which I am facing.
Basically I am taking three columns into consideration as below:
Question: I would like to remove duplicate values from above table based on conditon "
Equal value for "Time" ,"ID" and Absolute difference in "Time spent" is lower or equal than 1"
as you can see in the image Rows highlighted falls in this category.
I would like to get these below rows removed based upon condition.
Question: I would like to remove duplicate values from above table based on conditon "
Equal value for "Time" ,"ID" and Absolute difference in "Time spent" is lower or equal than 1"
as you can see in the image Rows highlighted falls in this category.
I would like to get these below rows removed based upon condition.
I am able to perform this in excel by making us of a fourth column with formulae =IF(AND(A3=A2,B3=B2,ABS(F3-F2)<1),"problem",0) and then filtering out the rows marked as probelm. Please help!!
Regards
Mahi
I bet the suggestion from #Alexis Olson works just fine, but since you specifically mentioned the Query Editor, here's how I would do it there:
Have your data loaded like below, and just accept the changes made under Changed Type:
Don't worry about the other steps under the Query Settings. We'll get to that eventually.
Select Add Column and click Index Column, so that you get this:
Select Add Column, click Custom Column and insert this little formula in the appearing dialog box Table.AddColumn(#"Added Index", "Custom", each #"Added Index"[Time Spent]{[Index]}-#"Added Index"[Time Spent]{[Index]-1}):
Click OK, and make sure that you're getting this:
I think this step is a little weird, but you'll have to click 'Table' there in the column:
You will get an Error message in the first row, but you can remove that by right-clicking that column, and clicking Remove Errors:
Now you can click the drop-down menu in the Custom Column, select Number Filter and Does Not Equal
And insert 0, or select 0 from the drop-down menu in the dialog box:
This is it, your required numbers should now be filtered away:
Note, however, that this procedure comes at a cost since you're losing the first value due to the first step in the indexing. If the rest of this is something you can use, I can see if we can fix that last little part as well.
You can pick a representative [Time Spent] value from each unique set of rows by taking a max or min over the list of "duplicate" values. Here's the formula for such a custom column, which I'll call [Min Time]:
= List.Min(
Table.SelectRows(#"Previous Step",
(C) => (C[Time] = [Time] and
C[ID] = [ID] and
Number.Abs(C[Time Spent] - [Time Spent]) < 1)
)[Time Spent])
Once you have this custom column, you can group by [Time], [ID], and [Min Time] to roll up the duplicates and then rename the [Min Time] column to [Time Spent].

Highlight row when two cells match

I have a sheet where on column "F" I enter the number of items purchased and on column "I" the number of items sold.The actual data starts at row 4. I want to change the color of the rows when the number of sold items matches the number of purchased items. I was able to do that with conditional formatting and the formula : =$F4=$I4 . This works ok but my problem now is that all the empty rows change color since there is no data in either of the columns and so they match. I tried filling out the sold items column with 0 but it didn't work. Any ideas ? Thanks.
I used this and it works :
=AND($F4>0,($I4+$J4+$K4)=$F4)
This way the row will get highlighted when the sum of I+J+K = F but only if there is a value bigger than 0 in F.

Combining formulas

Please help me with combining these two formulas:
REGEXP_EXTRACT([resolution],'(\d{2}:\d{2})')
IF CONTAINS([resolution],"closed") and NOT CONTAINS([resolution],"resolution") THEN 1 ELSE 0 END
Example:
I have lines
1.resolution(01:01) Completed repair equipments
2.resolution(01:02) Preventive maintenance
3.The problem is not current
4.resolution(01:03) Completed repair equipments. The problem is not current
I have 2 calculated field.
REGEXP_EXTRACT([resolution],'(\d{2}:\d{2})') - find numbers 01:01,01:02,01:03
IF CONTAINS([resolution],"closed") and NOT CONTAINS([resolution],"resolution") THEN 1 ELSE 0 END - excludes records:3.The problem is not current
I want to make a formula which combined two formulas and displays numbers:01:01,01:02,01:03
I assume you are trying to use these in a calculated field?
You should be able to pull the initial one into your second calculated field. So if you create your first calculated field(analysis->create calculated field) and lets call it "Calc 1". So this will have your initial formula:
REGEXP_EXTRACT([resolution],'(\d{2}:\d{2})')
Then create a second calculated field and call it "Calc 2". In this formula just update your original to call the first calculated field which contains your formula:
IF CONTAINS([Calc 1],"closed") and NOT CONTAINS([Calc 1],"resolution") THEN 1 ELSE 0 END

vlookup to find match and return another element in row

i have two sheets. first column of both sheets has userids, but there is only some overlap of ids between the two sheets. i want to keep the userids in the first sheet, but in the second sheet, the second column has a point of data that i want. for those userids in the first sheet that are also in the second sheet, i want to get this data.
so, for say the first row's userid in the first sheet, how could i use vlookup to find that same userid in the second sheet (if it exists), get the value of the second column of that match, and bring it back to the second column of the first sheet?
thanks
Modify and put this formula into the first cell of the second column on the first worksheet. Then copy and paste it down the column:
=VLOOKUP(A1, Sheet2!A$1:B$100, 2, FALSE)
Let's look at the parameters for this function:
A1: This value, on this worksheet, is what we're searching for in the range given in the next parameter. When you copy and paste the entire formula down the column, it increments the row # with each row. In row 2, it will be modified to A2, and so on.
Sheet2!A$1:B$100 : This is the range that we are interested in, on the second worksheet. It is the top left to bottom right cell. The $ symbol tells Excel not to change the row #'s when you copy and paste the formula down the column. Modify B$100 to fit the range of data you are interested in... something like B$30 if you only have 30 rows of id's on the 2nd sheet.
2: This is the column you are interested in retrieving the value, relative to the above parameter. In this case, the 2 corresponds with column B.
False: This instructs Excel to find the exact match.