Count of Open and Closed date (Two dates in Data set) are showing wrong when applying filter for specific year or month (Tableau) - filter

Raw data before visualization
Visualization look like this
I am facing one problem in when building a Visualization of IT- tickets which has open and closed date
column I have to count each month open & closed tickets everything looks fine until we create Date filter Date filter pic (MMMM YYYYY) from open date column.
Suppose ticket-1 was open on 21-12-2022 and the ticket is closed on (15-02-2023) and we applied filter for to show only current year(2023 include JAN & FEB ) but it gives wrong output of closed tickets of 2023
because year filter(2023) remove all open date rows which not comes under 2023 which also contains closed date which directly result in wrong output of count of closed date
until I select previous year month from the filter.

You want to reshape your data into a table with one Date column and a new Action column that has the value Open or Close. So each closed ticket in your original data turns into two rows in the reshaped table, one row for the open event, and a second row for the close event. If the ticket was still open, it should get one row in the reshaped data for the open event.
You can reshape the data with Tableau or Tableau Prep by unioning the table with itself and then using calculated fields and filters to create a single date column, filter out the second row for still-open ticks and to distinguish Open Actions from Close Actions.

Related

Excel Power Query storing the old data in a column

In excel power query I have a linked excel file where only the last column is updated by the team. For example is the cut-off data day is Jan 13th then the data is titled Jan 13 and the rows are updated for this week. When the update is done the following week, the column header is changed to Jan 20. How can I keep the old data for Jan 13th in power query so that I only get the new data in a new column when refreshed?
I tried but I am stuck
PowerQuery doesn't store any data, it's essentially a transformation script, that uses whatever is in the linked source when refreshed. So if the data for 13th is gone at the source it will be gone in PowerQuery too. If the column for 20th is added next to column for 13th, then you can create a dynamic logic that would keep more columns.
You could create a logic preserving the historical data using VBA (to store it in the not linked table), but in Excel & M it is not possible. With PowerBI there is an option of incremental refresh that potentially could be used here, but it's not available in Excel

I am trying to do a Month Over Month review but not all months have data and the users want placeholders for the months with no data

I am trying to do a Month Over Month review but not all months have data and the users want placeholders for the months with no data. I was trying to use my start and end date parameters but I am not getting anywhere.
I am using SSRS - attempting to use a matrix to show on the left hand side for the rows the Month and the column grouped by current year and prior year which is generated from my date parameters. I have four date parameters; a current year star, current year end, prior year start and prior year end.
I can get the matrix to populate if the prior year has data for a month that the current year does not and vice versa but I cannot get the data to populate with a placeholder for a month with no data.
Has anyone had success doing this without using a CTE?

Visual Studio Report Designer: I don't understand group filters

I'm writing a report that has proposal information by estimator per month. So I created a matrix where each row is grouped by estimator and each column is grouped by the month.
The thing is, my query includes data for this year AND last year, but the columns by month should only contain this year's information. So I though simple, I'll create a filter: Year(variable_date) = Year(Today()).
When I do this, no record information shows up. But then I changed the column to group by month AND year and suddenly, it works. Only 2015 records show up in the calculations per month.
Why did I need to group it by month AND year? Why couldn't I just group by month and have the filter remove records that didn't have the correct year using the filter group property tab?
Thanks!
P.S. I hope I have the tags right...
It sounds like month and year are separate fields. So when you group only by month it is grouping all of the rows where the value for that field is the same. (Month=8 exists in 2014 and 2015.) The values are just numbers to SSRS and it doesn't know it needs to look at the year field too unless you tell it to.

What's an elegant algorithm for constructing a sequence of dates with a single state?

Given any series of input dates with a single state of either Open or Closed such that at a very minimum there is a single input date (open state) which results in a single date (Closed, max Date) being added to complete the output sequence what algorithm would you use to generate output which obeys the following?
1. There are no consecutive Open dates and no consecutive Closed dates.
2. For each Open date there is exactly one Closed date.
3. The first date should be Open and the last date should be Closed.
4. Apart from the first Open date and the last Closed date each Open date should immediately follow the previous Closed date, or put another way, each Closed date should be the day before the next Open date.
5. The final date is Closed and Max date (9999-12-31, in this example)
This is not a homework exercise, I've implemented this in C# and it's production code that will execute millions of times. Performance is important, yes, but very much secondary to readability. The algorithm I've used works perfectly well but looks awful. Any language welcome. I'll translate as necessary. Thanks.
Example 1
input:
[2000-01-01,open]
output:
[2000-01-01,open]
[9999-12-31,closed]
Example 2
input:
[2000-01-01,open]
[2001-01-01,open]
output:
[2000-01-01,open]
[2000-12-31,closed]
[2001-01-01,open]
[9999-12-31,closed]
Example 3
input:
[2000-01-01,open]
[2004-04-30,closed]
output:
[2000-01-01,open]
[2004-04-30,closed]
[2004-05-01,open]
[9999-12-31,closed]
Example 4
input:
[2000-01-01,open]
[2000-03-17,open]
[2002-09-11,closed]
[2003-04-07,closed]
output:
[2000-01-01,open]
[2000-03-16,closed]
[2000-03-17,open]
[2002-09-11,closed]
[2002-09-12,open]
[2003-04-07,closed]
[2003-04-08,open]
[9999-12-31,closed]
Dare I ask which class of language solves this kind of problem best?
Sort the input by date.
Iterate through the input, keeping track of the current state.
If state is open and an open date is encountered, insert a closed date.
If state is closed and a closed date is encountered, insert an open date.
If state is closed and an open date is encountered that is not the day after the previous closed date, insert an open date and a closed date to fill that gap.
When done iterating through input, if state is open, insert final closed date.
When done iterating through input, if state is closed and final closed date is not 9999-12-31. insert the final open and closed dates.
You can first generate a list of all open dates and then calculate closing dates by subtracting one day from each but the first opening date:
C# pseudo-code:
var opendates = input.Select ( date =>
date.Type == closing ? date.Date + 1day : date.Date
).Sort ();
closingdates = opendates.Skip (1).Select (date => date - 1).Append ( new Date [] { 9999-12-31 } );
So the solution should be fast since performance is crucial here. Also it should support online processing, so when the system is running you can add new opening/closing dates at any time you want and get an updated schedule immediately.
As the major operation in this problem is sorting, I would suggest to use a heap. Each node in the heap stores a date/state pair. The algorithm initiates with an empty heap and continuously develops it as reading inputs. When there's new data coming, the algorithm inserts it into the tree, which takes O(lgN). When there's a request to pull a schedule, the algorithm performs an in-order traverse, which takes O(N). The algorithm also should balance itself once a while for better performance.

SSRS how to show only month/year as a parameter using/customizing calendar control

I use SSRS 2005.I currently have two datetime parameters (for start and end dates) as parameters for my report. I get the default calendar controls to select the dates.
I want to show only month and year in the calendar control which can be selected by user. Is that possible?
I can create two text fields and let user enter month & year in each text field and i've two validate these two text fields. I dont want to do this because needs typing into the fields.
OR
I can create four dropdown lists for start month, start year and end month and end year with values but this involves clicking/scrolling a bit more. Dont want to do this either.
Can somebody suggest a solution?
Thank you
Bo
This cannot be done using the calendar control.
You can either use the calendar control ignoring the day or implement one of the other two solutions you mentioned.
In case of combobox, you can use select distinct month/year from your data to fill values.
To make this less annoying for your user's to run the report, default your month/year from/to values to these that usually the user selects to run the report.
Personally I would prefer textboxes with default values
eg. If user runs the report for current year from January to current month then the defaults would be
Month from: = 1
Month to: = Datepart("m", Now())
Year from, Year to: = Datepart("yyyy", Now())

Resources