I get incorrect numbers while dividing two columns - powerbi

With this code and the attached photo why I get incorrect numbers ?!! In the last column in each row I want to get a division of two numbers in each row
priceofeachunit = DIVIDE(data_sales_20k[20KG_Bag_RevenueEUR],data_sales_20k[20KG_Bag_UnitsSold])

Related

Highlight row with highest cell value within dynamic range

I want to highlight the cells in a Google Spreadsheet with the highest values based on a dynamic range.
I've got two columns: column K and column L. Column K contains sums of data, column L contains either 'Yes', 'No' or 'Maybe'.
I want to use conditional formatting to highlight the rows with the highest value in column K AND which contain 'Yes' in column L (so, the highest value in column K is only calculated from the rows that contain 'yes' in column L as well). It is possible that there's multiple highest values that have 'Yes'. So while the absolute highest value in the whole of column K can be found on (for example) K100, and the second-highest is found on K59, if L100 doesn't include 'Yes' on column L but L59 does, row 59 will be highlighted.
I've got this code for highlighting whenever L is equal to 'Yes':
=$L:$L = "Yes"
And this code for highlighting the highest value in column K:
=$K5=MAX($K$5:$K$999)
But I have to combine them somehow.
I think that some kind of IF- or AND-statement will be the solution, but I don't know how to dynamically call on the range I need. The position of the Yes'es change based on other values and are not necessarily below each other. For instance:
=IF($L:$L="Yes";MAX($K1;$K3;$K4;$K9))
Where '$K1;$K3;$K4;$K9' represents the dynamic range.
try like this for range A5:Z:
=($L5="Yes")*($K5=MAX($K$5:$K))

Comparing numbers in Calculated Column formula, inside a simple OR Condition then IF Condition is not returning Correct Value in SharePoint

Simply trying to compare numbers in formula for calculated Column Total Days in Route. The numbers to be compared are returned by subtraction like TODAY()-[CurrentRouteDateTemp] where the column CurrentRouteDateTemp is of type Date
See column descr
Why is it still just returning the value from the main calculation i.e. TODAY()-[CurrentRouteDateTemp] Why the rest of the condition not working????
See list view
Try to add value function in the formula, like this:
or(value(TODAY()-[CurrentRouteDateTemp])=43725,value(TODAY()-[CurrentRouteDateTemp])<0)

Can't count cells populated by a RegExMatch function

I am attempting to count the sum of a column populated by a RegExMatch function but using a COUNT function, eg =COUNT(F2:F100).
The function that populates a cell with '1' is:
=IF(RegExMatch($E2,"SKU123"),"1","")
I can see '1' appear many times in the column but when I attempt to sum the column I get a zero answer.
Any suggestions for how I perform a better RegExMatch (or alternative) or way to sum the column?
Change your formula from
=IF(RegExMatch($E2,"SKU123"),"1","")
to
=IF(RegExMatch($E2,"SKU123"),1,"")
and will work.
COUNT returns the number of numeric values in a dataset, and you were filling with strings. SO in your version it will always return 0.

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.

How do I change the individual value to be summed during annotation in Django?

I am front end developer new to django. There is a certain column(server_reach) in our postgres DB which has values of (1,2). But I need to write a query which tells me if at least one of the filtered rows has a row with reachable values( 1= not reachable, 2 = reachable).
I was initially told that the values of the column would be (0,1) based on which I wrote this:
ServerAgent.objects.values('server').filter(
app_uuid_url=app.uuid_url,
trash=False
).annotate(serverreach=Sum('server_reach'))
The logic is simple that I fetch all the filtered rows and annotate them with the sum of the server_reaches. If this is more than zero then at least one entry is non-zero.
But the issue is that the actual DB has values (1,2). And this logic will not work anymore. I want to subtract the server_reach of each row by '1' before summing. I have tried F expressions as below
ServerAgent.objects.values('server').filter(
app_uuid_url=app.uuid_url,
trash=False
).annotate(serverreach=Sum(F('server_reach')-1))
But it throws the following error. Please help me getting this to work.
AttributeError: 'ExpressionNode' object has no attribute 'split'
Use Avg instead of Sum. If average value is greater than 1 then at least one row contains value of 2.