I have a StoredProcedure for Project table I want to select "ProjectStartDate" with format MMDDYYYY -> 07092021 and the data is going to print on an Excel spread sheet.
The code that I wrote is:
select
replace(convert(varchar, pp.ProjectStartDate,110),'-','')
from Project pp
But on the spread sheet the Month is 1 digit 7092021.
Please advice, Thank you
In MySQL you can use
date_format(ProjectStartDate,'%m%d%Y')
Related
I have a problem writing down a formula or a script in Google Sheet or Google App Script to find and count the values in a sheet where the number and references to the columns change.
I have a script that copy&paste the Sheet files for the staff shifts of every week from a Drive folder and merge them side by side (in horizontal).
In this sheet that contains all the shifts merged I want to count all the cells of the staff filtered only for handler and picker (column B, K, etc.) according to a specific date (row 3) for every hour.
Example: if today is 28/10/2020 find the right column with the same date in row 3 --> column E, count all the values from row 4 filtered by picker or handler for every hour (10 people at 05 AM).
Do you think that I can implement this with a formula (like a matrix, vlookup, etc.) or should it be written as a Script?
Thank you very much,
Marco
Please use the following
=COUNTA(QUERY({A3:I;J3:R},"select Col"&MATCH(A1,A3:I3)&"
where Col2 matches 'Technician|Picker' "))
Where B1 holds the date you wish to search for (28/10/2010)
Try the below formula. Replace date with your search date.
=COUNTA(INDEX(A4:R14,,MATCH(DATE(2020,10,28),A3:R3)))
This was earlier tagged as excel. This is how to "tackle" this in excel (office 365):
In a clear column use the following formula to get the unique hour-values that are in the column that equal today:
=UNIQUE(FILTER(INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0)),INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0))<>""))
In the column next to that type the following to get the result of the count of those unique values for that day:
=COUNTIF(INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0)), FILTER (I:I,I:I<>""))
Where I:I in FILTER (I:I,I:I<>"") needs to be changed into the column you put the first formula.
Stuck at a specific measure calculation which looks like this in tableau
1.) zn(COUNTD(if not isnull([Order_number]) then [Order_number] END)).
I tried using isblank dax function but it is not working as i expected it to be.
How will the same measure be written in Powerbi using DAX?
Problem 2
Simultaneously, not able to get the output for a particular calculated column in powerbi for which the tableau query to derive that particular column looks like this:
2.) zn(IF CONTAINS([Record Type],"High") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '08520' THEN 7 ELSEIF CONTAINS([Record Type],"Junior") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '8520' THEN 7 end
I re created the above by Creating a custom column named it as Day Name deriving day name from the date column and Wrote an equivalent query in Powerbi query editor to create a custom column, query mentioned below. Even though there is no syntax error, it is giving 0 for all the rows in that particular calculated column.
slots= if([RECORD_TYPE]="high" and [Day Name]="Sunday" and [LOCATION]=08520) then 7 else
if([RECORD_TYPE]="Outbound" and [Day Name]="Sunday" and [LOCATION]=3109) then 7 else 0
Any kind of lead or help will be much appreciated.
Thanks in advance
For 1st problem:
zn(COUNTD(if not isnull([Order_number]) then [Order_number] END))
So, If i break this query basically, zn is a function used in tableau to convert all the null values to zero and as countd implies to the entire if statement above.
I was able to write an equivalent dax query for it mentioned below, if anyone out there can tell me or verify if it is correct or not, I'll be really thankful.
IF(ISBLANK(DISTINCTCOUNT(Order_table[ORDER_NUMBER])),0,DISTINCTCOUNT(Order_table[ORDER_NUMBER]))
As far as the second problem goes, im not able to find a solution to it and the value for that column for all the rows stands at 0 as I'm writing this answer to 1st problem. Any kind of help or lead will be much appreciated.
Thanks
I'm new to power BI and trying to create a new column similar to this formula in excel:
=**IF(COUNTIFS(D:D,[#[FIVE9_AGENT_NM]],E:E,[#[FIVE9_CALL_SKILL]],C:C,[#[FIVE9_ANI]],H:H,"<"&[#[Date & Time]],H:H,">="&[#[Date & Time]]-5),0,1)**
Im stuck at this point not knowing how to convert the column to refer the row cell in the countif formula for example =COUNTIFs(H:H,H2,A:A,A4) would be easy to achieve in excel not sure now to reference the a cell in powerBi.
I have a table
Call_Dt| Five9_CALL_TIME| FIVE9_ANI| FIVE9_AGENT_NM| FIVE9_CALL_SKILL
_______|________________|__________|_______________|_________________
8/28/19| 12:23:07 |222333777 | JOHN | Billing
I want to create a new column which counts the records having the criteria n the excel formula above.
Any help on this will be greatly appreciated.
Thanks in advance!
Use CALCULATE along with FILTER:
Measure =
CALCULATE(
COUNT([column]).
FILTER(
[table],
//your filter conditions
)
)
Find more about these functions here: Calculate, Filter
the data sample imageHow to clean/re-organize data in R/R Studio in case a row variable has more than one entries under the column variables ? e.g. I have a data-set that has 13 columns , and 14 rows, in each of the month tab of an excel workbook depicting a year, there are 5 workbooks like this. So, in total there are 5 * 12 = 60 tabs. In each of the month tab, before the second/third/ etc. row starts, the previous row already has multiple entries under a column head, like the one in the attached image at the beginning.
how to format/clean this whole data, including all the months in a year, and also accounting for 5 years on trot, and make this suitable for analysis ? Thanks in advance .
Are you looking to import the excel data into R studio?
Look at the library "xlsx" in order to read excel sheets in.
This will be entered into your environment as a data frame. Available for you to analyse. If you want to have R studio recognise dates, then look at the library "lubridate".
You aren't particularly clear as to what you want here, after you've done some R coding, put it up, and we can help further.
I have been connecting Tableau to a csv data source. I have two date columns. When I tell Tableau they are date columns it imports the entirety of both columns as Nulls. I tried to import them as strings and create a calculated date column out of each with DATEPARSE.
I ran this ([Close Time] is the string from the CSV)
DATEPARSE("mm/dd/yyyy hh:mm:ss",[Close Time])
and named the column "Close_Time_DT"
The result was:
Close Time
'05/30/2013 11:20:50'
'05/30/2013 18:01:53'
'06/05/2013 02:02:49'
Close_Time_DT
'1/30/2013 11:20:50 AM'
'1/30/2013 6:01:53 PM'
'1/5/2013 2:02:49 AM'
Clearly this is wrong, I tried also with
DATEPARSE("m/d/yyyy hh:mm:ss", [Close Time])
and got the same result.
Thanks in advance for your help
I had a similar problem. My source csv format for dates was date/month/year (07/01/2015). When I used Dateparse function i first entered it as
DATEPARSE("dd/mm/yyyy",[ServDate])
but it did not properly handle the month and would make it July or in one case put all the dates in the same month (january).
What finally worked was to use:
DATEPARSE("d/M,y",[ServDate])