How to show missing dates on PowerBI Clustered Column Chart - visualization

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).

Related

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.

Compute rolling average across years while displaying data split by year

The dashboard in the linked workbook shows a table with sales split by year on the top. Below, there's a table with the rolling average of the last 4 weeks, including the current. It's set to show NULL if there are not enough data points. I'd like for it to compute the first January 2018 value based on the current week and 3 full weeks from the end of 2017. Carrying that concept forward, all NULLs from 2018 onward will be eliminated. The NULLs for the first 5 weeks of 2017 will be the only NULL values. The average should always be computed on a full 4 weeks (28 days) even when week 53 doesn't contain 7 days.
How can I write a calculation to achieve what's described above?
I've tried putting the WINDOW_AVG function inside a LOD, but that's not allowed. Furthermore, I've also tried using FIXED and even FIXED inside WINDOW_AVG.
Here's one of my attempts:
{FIXED [Week_int]:
WINDOW_AVG(SUM([Sales]), -4, 0)
}
It returns this error: "Error: Level of detail expressions cannot contain table calculations or the ATTR function"
Here's the data structure. It includes one value of Sales per day.
Basically I created a dummy data in Excel by creating dates (from 1-1-2017 to 2-2-2021) and filling some random values (unif dist *5000) against these.
I added Week[date] to columns and year[date] to rows as in your screenshot. I added sum(value) on the text marks card.
Thereafter, I added table calculation --> Moving average --> edited it for previous 4 values , next 0 values, (check current value if you want to include current record), then check Null if there are not enough values. (your requirement). --> click compute using -Specific Dimensions change the order of fields below - drag Year above than week (table across then down will also create the same view)
You should be able to get a view as desired.
Regarding your query on number of days in the week, Tableau caters it automatically if you have chosen it datepart.
Edit I verified this in Excel, the method is correctly working.
See, the average of first 28 values in Excel
and the view built in tableau:
Here's the corrected dashboard hosted on Tableau Public.

Calculate Number of Hours worked in Tableau

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]))}

Default range for date range filter in tableau

I want to set the default range on a date filter to show me the last 10 days - so basically looking at the lastDate (max date) in the data and default filtering only on the last 10 days (maxDate - 10)
How it looks now:
I still would want to the see the entire range bar on the dashboard and give the user the ability to modify the selected range if he wants to. The maxDate changes after every data refresh so it has to be some sort of a condition that is applied to the filter.
How I want it to look (by default after every refresh of data - new dates coming in):
Any suggestions on how this can be done? I know I can use the relative date and show the data for last 10 days but that would modify the filter and create a drop down which I don't want.
Any suggestions are welcome!
One simple approach that does most of what you want is the following:
Create an integer valued parameter with a range from 1 to some max
you choose, say 100. Call it say num_days.
Show the parameter control on your dashboard as a slider, and give
it a nice title like "Number of days to display"
Create a boolean calculated field called Within_Day_Range defined as:
datediff('minute', [My_Date_Field], now()) < [num_days] * 24 * 60
Put Within_Day_Range on the filter shelf and select the value true.
This lets the user easily select how many days in the past to include, and works to the granularity of minutes (i.e. the last two days really means the last 48 hours, not starting at midnight yesterday). Adjust the calculated field if you want different behavior.
The main drawback of this approach as described so far is that it doesn't display the earliest date possible in the database because that is filtered out. Quick filters do an initial query to get the bounds, which has a performance cost -- so using the approach described here can avoid that query and thus load faster.
If you really need that information on your dashboard, you could create a different worksheet to get just the min([My_Date_Field]) and display that near your parameter control.

Crystal reports crosstabs column grouping

I'm trying to build a cross tab report in Crystal XI that has dates, grouped by the month as column heading, and have 2 questions I'm trying to find answers to.
1: Is there any way to display a month even if there are no records to be summarized in that month? i.e. no orders for March, but want to display Jan, Feb, Mar.? I'm pretty sure I can create a dates table and use that spoof it, but don't want to go that route as the database is part of a Vendor's package and I don't want to get to crazy in there.
2: Is there a way of specifying or limiting how many columns go across? For example in a forecast cross tab I only owant current month and the next six months to show up. I suppose I can do a date range on the selection criteria, but that seems a bit kludgy to me.
Thanks for any answers
Short answer: No.
I've seen discussions about workarounds involving creation of temporary tables, but I've never tried any such solutions myself.
I would go with the date range on the selection criteria. You could make those dates parameters for more convenient useage. If you have sevral cross-tabs that should have different date ranges you could put the crosstabs in sub-reports.