Tableau Dimension grouping and Using two date fields? - tableau-api

I have two questions. First - I am trying to create a new status using Jobstatus as shown below. How do I combine "Installation_Complete" & "Unviable" into a new field name "Total Visited", How do I combine "Installation_Complete" & "Unviable" & "Need_Reschedule" into a new field name "Total Scheduled"? As well as have "Installation_Complete" as Total Installed? Example below ideally it would look like this for WK45...
Total Scheduled - 1,985
Total Visited - 1,925
Total Installed - 1,859
2nd Question - In my workbook I am primarily using two Date fields. "install_date" & "date". Installation_Complete should be referencing "install_date" while Need_reschedule & Unviable should be referencing "date". In the picture above I am using "date" in columns, so the Installation_complete is actually skewed because of the date field I am using, so how would I use both date fields?
Ex. WK45 - Installation_Complete should be referencing 'Install_date" WK45 while Need_Reschedule & Unviable should be referencing "date" WK45
It would be very helpful if anyone could help me out with their input!
Thanks,
Phillip

Since you have not given any data that can be copied, I tried recreating some sample data
This was arranged in a crosstab view like you uploaded as a screenshot
Perhaps you want this.
To this I have added a table calculation Running sum on table down and edited the aliases. For more clarification, please upload some sample data that can be copied (not as screenshot). Good Luck
PS In you screenshot the grand totals are arithmetically incorrect. Please have a look.

Related

How can I add a dynamic date column on Power BI

I have a question on Power BI, basically i have a column with date (HIREDATE), and my task is to add a column that calculate the difference between the ACTUAL date and the date on my column. So it needs to be dynamic.
I watched some youtube videos but haven't found a case like mine, even though i think it's a common, not very rare task.
Following a tutorial on Youtube and on Microsoft WebSite I added a custom column named Experience with the following code :
= Duration.ToRecord ( YEAR(TODAY()) - [#"Date d'embauche"]) /* Date d'embauche = HIREDATE in french*/
It shows me :
No syntax errors have detected
But when I click on
OK
It shows me this :
Expression.Error: The name 'YEAR' wasn't recognized. Make sure it's spelled correctly.
Please help me solve this.
For Power Query you would need DateTime.FixedLocalNow() to get the date time, then wrap that function with Date.Year to extract the year, so you would have the following:
Date.Year(DateTime.FixedLocalNow()) - Date.Year([#"Date d'embauche"])
in this example, the formula is used in a custom column, to give the time difference in years.
Normally it is best to do these sort of transformations in Power Query before getting to the data model.
Probably you are adding the Custom column in Power Query. I would rather recommend to add a Calculated Column through the following DAX expression:
Date difference =
YEAR (
TODAY ()
)
- YEAR ( 'Table Name'[HIREDATE] )

How do I use Tableau to populate the count of each dimension over a time period?

How do I populate the number of purchases and sales per day in tableau?
Here is my Sample Data:
In my first attempt, sales numbers are not counted to the exact date.
In my second attempt, I tried to tabulate by dropping sales date into the rows. However, it returned two figures - purchases and sales.
I have also tried Calculated Field but Tableau is unable to do a "for loop" like python.
First attempt:
After dropping Sales Date into the Rows. This is what I get:
Is there any way to populate it like this? Please help, I am still new to tableau. Special thanks to Fabio Fantoni for the first solution!
Desired Format:
I have another sample data (refer to sample data 2) which I would like to populate in the desired format (refer to desired format 2). In Sample Data 2, the purchase date "15/12/2020" is not reflected in sold dates.
My apologies but I may require some guidance as I am still new to tableau. Thank you in advance.
Sample Data 2:
Desired Format 2:
Based on this sample:
In order to bypass your double count for two different date columns, you may want to cross join your original data with a copy of it on original.Purchase = support.Sold, like this:
Doing so, you just have to create two calculated fields:
count Purchase:
count([Purchase Date])
count Sold:
Count([Purchase Date (Foglio11)])
The only thing you have to pay attention to is that in the second calculus you have to count Purchase date due to your "inverted" cross join.
You should get something like this:

In Tableau, is there a way to only show the first and last date in the table output using the date filter

Tableau will generally show every single date within table output of the date ranges filtered for. Is there a way to only show the first and last date in the table for the date of ranges selected?
I created an image of the desired output in excel. Link below:
Desired output example
Thank you in advance!
The feature that will address your goal is called a Level of Detail (LOD) calculation. They have many uses and take various forms. I suggest reading about the in the online help.
But, to answer your question, the LOD calc to find the first (i.e. minimum) value in a date field called, say, Transaction Date, is;
{ MIN([Transaction Date]) }
The formula for the latest value is left as an exercise for the reader 😊

POWER QUERY APPEND date is missing

I have two tables with similar columns
Apply append, all details were ok except for the date of the new table.
Old data dates are available, but the new one is missing and specified as "null"
I check their format, both are the same
Anyone once knows what is the issue.
Below screenshot for reference
enter image description here
It's look like new table has different column name for date.

Using Crystal Reports year to date

I am relatively new to using Crystal Reports. I am pulling the correct information from my database however I need to only pull the information from the beginning of the month to the current date, i.e. 09/01/2013 - 09/23/2013. Could anyone give me a snipit of code on how that would look.
Much appreciated.
The best way is you need to filter the data before it is populated on reports i.e. filtering the query itself. The other option is to create new parameter for the selected field and passing the value on runtime.
http://www.codeproject.com/Articles/205398/Crystal-Report-Filtering-Using-Selection-Parameter
In below figure you can add the records selection on the required field and add the condition similarly