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
Related
I have a table of number of visual:
visual_1000x123
0
1
I would like to use a dropdown list to let people select 0 or 1.
If 1 is selected, the calculate result will be xxx(let's say 55k).
If 0 is selected, the calculate will be 0.
Maybe I should mention that there is a time filter, which works well.
The result varies according to the selected period.
This measure keeps giving me 0:
measure = IF(MAX('Simulateur'[visual_1000x123])=0, 0,
CALCULATE(SUM('Prévision Leaderboard'[Budget_impressions/1000x123_et_1000x167])) +
CALCULATE(SUM('Prévision Middleboard'[Budget_impressions/1000x123_et_1000x167])))
This measure keeps return 55k:
measure = IF(MAX('Simulateur'[visual_1000x123])=1, 0,
CALCULATE(SUM('Prévision Leaderboard'[Budget_impressions/1000x123_et_1000x167]))+CALCULATE(SUM('Prévision Middleboard'[Budget_impressions/1000x123_et_1000x167])))
I also tried to multiply the number of visual, but it didn't return anything:
measure =
(CALCULATE(SUM('Prévision Leaderboard'[Budget_impressions/1000x123_et_1000x167])) +
CALCULATE(SUM('Prévision Middleboard'[Budget_impressions/1000x123_et_1000x167])))*MAX('Simulateur'[1000x123])
If I am understanding your question correctly, you just want to multiply a number in a column by a factor (which is in a slicer, or visual).
If that is the case you can do it simply as follows:
column1 * factor result = AVERAGE('Table'[Column1]) * AVERAGE('Table (2)'[factor])
Posting this answer myself.
It's due to my data structure. All the data was in one table and I should have them seperated into different tables.
so I have been working on automating this table for the most performing person of the week on google sheets.
now on the column O i have top candidate, I want to run an if statement that would check through the values of each person. for example, for day 1 it would check from K3 to N3 once it gets the value, it should post the name of the candidate. That means for week 1, day 1, it would check and see that charles has the top performance and post "Charles" on the top candidate cell of the same row.
so far i know how to know ts easy getting the number between the cells which has the biggest value =max(K3:N3) but then combining it with an if statement that would know the cell on top... that got me worked up and still not found an answer
This formula should work:
=INDEX($K$2:N,1,MATCH(MAX($K3:$N3),$K3:$N3,0))
MATCH will find a specific column that has the max value of K3:N3, then INDEX will reference the value of the top column.
Sample Sheet:
use:
=ARRAYFORMULA(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IFNA(
IF(IF(K3:N="", "x", K3:N)=QUERY(TRANSPOSE(QUERY(TRANSPOSE(K3:N),
"select "&TEXTJOIN(",", 1, IF(LEN(J3:J),
"max(Col"&ROW(A3:A)-ROW(A3)+1&")", ))&"")),
"select Col2"), K2:N2, ))),,9^9))))
I have a matrix in Power BI which shows counts by Category and by Country (please see table 1 below for example).
I want to create a measure to 'suppress' any counts in that matrix (by replacing the count with "...") that are lower than 3 IF the value of another column in the same source table = 1. IF the value is not equal to 1, I want to suppress any counts in that same matrix that are lower than 10.
To clarify, countries 1 to 5 have either a value of 1 or 2 for the column on which the suppression depends, and within the table it would look like this:
With this measure in the values field, this would produce a matrix that looks like this:
I have been able to achieve the first part (suppressing counts less than 3) using the following DAX syntax to create the measure:
Less than 3 = IF([COUNT]<3),"...",[FORMCOUNT]
But I have struggled to incorporate the second condition. I imagined it would look something like this:
Less than 3 or 10 = IF('Table'[conditional column] = 1
,(IF(AND([COUNT]>0,[COUNT]<3),"...",[COUNT]))
,(IF(AND([COUNT]>0,[COUNT]<10),"...",[COUNT])))
But that doesn't work. I have tried various variations of this syntax using functions such as FILTER that allow you to specify the column and condition but no luck.
Any pointers would be greatly appreciated, thanks!
This may not be the perfect answer but the below appears to do what is required:
Two measures are required:
Measure1 = SELECTEDVALUE('Dataset'[Suppression category],"NA")
Measure2 = IF('Dataset'[Measure1] = 1,IF([COUNT]<3,"...",[COUNT]),IF([COUNT]<10,"...",[COUNT]))
Unfortunately can't currently explain why or how the first measure works, other than that I think it serves to select/distinguish between suppression categories 1 and 2.
The second measure uses the first measure as a condition in a nested IF statement, such that if the suppression category = 1, suppress the count if it is less than 3, otherwise do not suppress the count. IF the suppression is not 1, then suppress the count if it is less than 10. Otherwise, do not suppress the count.
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.
I am a DBA of 7 months so please bear with me. I am needing to write a code that will find a particular ProductIdentifier. When this particular ProductIdentifier is found, 1. I need to grab this ProductIdentifier. 2. I need to go 2 rows up and place that ProductIdentifier in the field that is 2 rows above it.
Here is my code(everything is sorted properly already in this table)
SELECT
SipID,
SaleInvoiceID,
AssociationNumber,
Priority,
TotalPrice,
TotalCost,
SerialNumber,
ContractNumber,
ActivatedThroughPAW,
DateCreatedatMidnight,
ReceivedDate,
InvoiceIDByStore,
Location,
ProductIdentifier,
Description,
ShortDescription,
CategoryName,
RevenueStreamID,
RevenueType
FROM REVISEDTABLE.
I will better show you what needs to be done ![enter image description here][1]
ProductIdentifier
AWUPG2001RGP -- replace this product identifier with the 'AWRPNS000%'
POSC0021PRW
AWRPNS000343 --take this product identifier
What I need for this code to do is this: whenever I find any ProductIdentifier like 'AWRPNS000%', I need for the query to take this and go 2 rows up and replace whatever ProductIdentifier is in this with 'AWRPNS000%'. I then need to insert the results into a table. I believe the best thing to do is to select the ProductIdentifier row again and give it an alias. This will be the row that I need to transform. I can then do a comparison to see if things worked out. I do not know how to write the code to do the actual grabbing of the ProductIdentifier and going up 2 rows and replacing it, so any help or input would be greatly appreciated.
So what does two rows up mean. Why is it two rows up.
e.g.
ID Class Type Date
1 1 2 20/12/2012
2 1 2 21/12/2012
3 1 2 22/12/2012 *
ie yes ID is two rows up but that's because The records are in ID and date order and there are at least three of them.
If you can come up with that rule e.g.
Select * From SomeTable Where Class = 1 and Type = 2 And Date = 20/12/2012
Then all your problems go away...