Calculate Number of Hours worked in Tableau - date

Number of hours is fixed (8) multiplied by the number of distinct days a user has worked.
I need this number as text to insert into a title on a dashboard.
However I need to separate this number by the User filter from another worksheet. When I apply this, I just get the total number of distinct days (not per user).
This is the calculated field I have created so far:
countd(DATETRUNC('day',[_StartDate]))

Try using a Level of Detail calc fixing on user. something like {fixed user : countd(DATETRUNC('day',[_StartDate]))}

Related

Trying to come up with a formula that would return different greetings given per cell based on a list of greetings

I have created a daily journal in Spreadsheets where each day has it's own section. In each section, I created a questionaire that asks the user how they are doing in that day. I would like to add on top of that questionaire a different greeting per day, so I wrote a list with 30 variations in each cell (for example: "hello", "good morning", "buenos dias", "bon jour"...).
Where the different greetings will show up
list of greetings
I tried to use the rand() formula to select different greetings but since that formula is volatile and updates every time I make a change, it wont work for me.
As a solution, Each daily section starts with a cell countaining the date, so I thought that since each day would have a different greeting, I could use the number value of each date to drive the selection (for example: 05/05/2022 is the number value 44686, the next day is 44687).
I thought about using the Index formula but it requires that I use a number from 1 to 30 to retrieve one of those 30 greetings. I think that even if I were to somehow transform the date into a number from 1 to 30, perhaps in a few days, the value would end up being bigger than 30.
Anyway, I appreciate any help!
Gabriel

How to make all cohort weeks start from 100% mark in Line charts using Tableau?

I'm trying to build a weekly cohort analysis depicted by line charts in Tableau. The problem is that all weeks line should start from 100%.
Below is the process I took :
dropping order date to columns and selecting week number
COUNTD (order id) and in rows
creating a calculated field : first purchase date{ FIXED [User Id]:MIN([Order Date])} and then
Dropping first purchase date to color field
I'm getting weeks depicted as lines (different colors) but can't figure out a way to make all lines starting from 100% point.
Here is the screenshot of what it should look like https://prnt.sc/1uugad5
Link to the dummy data where order_id is unique Dummy Data link . Any help is appreciated
Thanks
To achieve the viz, I used COUNTD([User ID]) instead of order ID.
The x axis represent the difference of weeks between the order date and the cohort date.
Finally, the percent can be found using percent of total quick table calculation and using table across.

Tableau calculated field total number of records in title

I'm not sure if you can quick question someone can provide me with an answer for.
I am trying to add a total number of records to the title of a sheet, however every calculated field I do returns "1" as they must be just counting one row not all the rows.
Tried:
TOTAL(SUM([Number of Records]))
COUNT([Number of Records])
COUNTD([Number of Records])
I would like the title to say "Incidents Active over 7 days Total 12" (or whatever the number of records in the sheet are)
Put a calculated field that simply calls Size() on the detail shelf.
Click on that field and then Edit the Table calc to define the partitioning and addressing (aka compute using) This is the trickiest part. From your screen shot, it looks like you'd want to choose Specific Dimensions, and then set At the Level to Number. You may need to experiment or RTFM.
Insert Size() into your title
To understand how this works, especially the tricky step 2, read the on line help about Table Calc, and check out some of the videos and training materials on table calcs from the Tableau Conference. Last year's are available at http://tc19.tableau.com

Calculate a running total that works with relative date filters

I have a Union table of my various bank accounts to create a personal finance analysis dashboard.
I am trying to make a Running Total to show my total capital available at any given date. Using a Running Total table calculation works, just as much as using a RUNNING_SUM() calculated field. They both work up until I filter the dates. So I am trying to find a way to make the running calculation work without being thrown off by Date Filters (I would like to implement relative dates for visualisation in the dashboard).
My union table has the following relevant data columns:
Order ID: Descending number from 1 for each entry per account.
Date: Date of entry.
Item: Entry name.
Account: Name of bank account.
Amount: +ive for credit or -ive for debit.
Balance: balance after entry value for each given account.
So the table can look like this:
So on 07/05/2019 the Running total should be 229.64.
The running sum formula mentioned above is currently RUNNING_SUM(SUM([Amount])), so if any dates are excluded via filter the running total doesn't add up to the right amount.
A way I can see around the problem could be to get the sum over all accounts of the last balance reading at a given date. The balance is a running total but only if the final entry per time period for all accounts are summed would it work. Would it be possible to make a calculated field that gets the last balance reading for each account at any given date and then sums them?
Or is there a simpler smarter way I am not aware of?
This comes down to an Order of Operations problem. Once you filter the dates the viz doesn't have access to the data anymore.
Your best approach would be to add the running sum to the data source before you bring it into Tableau. Then the running sum isn't a calculated field dependent on the data in the Viz.

How to show missing dates on PowerBI Clustered Column Chart

I have a data set which has incidents resolved w.r.t date. I would like to look at the trends of number of incidents resolved over the past 45 days only on a Clustered column chart.
I couldn't see entries for specific dates (because the number of incidents resolved was zero on that day). How do I include those dates as well showing the number to be zero?
I tried the following:
1) Enabling "Show items with no data" - While this working fine, it is removing the last 45 days filter and is showing me unnecessary trends. The last 45 days filter is set on a page level and report level filter as well.
2) Creating a new measure to replace null values with 0 when the count of incidents resolved on a particular day is 0 - It again removed last 45 days filter.
Someone please let me know what I can do to get the required trends over last 45 days.
Thanks
This can be late reply, but I hope it may be useful for future users. As I suggested in a comment, you can try using measure for achieving this.
I have designed the following table with sample data.
INCIDENT_RECORD Table:
Created Measure:
Total Incident = IF(SUM(INCIDENT_RECORD[Resolved Incident])=BLANK(),0,SUM(INCIDENT_RECORD[Resolved Incident]))
Now I have designed Clustered Column Chart with & without Measure to show difference for you.
Clustered Column Chart with/without Measure:
First graph is showing label as 0 (Zero) which doesn't have any value
for that date.
Second graph is not showing data for Jan-03 in your case.
Feel free to ask your doubts/clarifications in the comment section.
First, make sure the column on your x-axis is a date data type. Then go to the Format tab for the visual and under the X-Axis options, set the Type to Continuous (rather than Categorical).