How to correct the order of the year in Qliksense? - qliksense

My data contain a column showing the year of each record, ranging from 2005 to 2017 I am using the Time Slide extension (https://github.com/caallard/Time-slide) to help me visualize the data. However, the order of the year is problematic.
As shown in the following plot, the first year in the slider is 2006, while the last year is 2005, which means the first year somehow shifted to the last.
I further checked my data. When I uploaded my data to the Qliksense, the preview of the data in the data manager window looks like the following. The year is not in the right order. Perhaps this is related to my question.
I would like to learn how can I fix this. Thanks.
Edit
I have a workaround for now. There are two tables in my Qlik sense both have a column showing Year. Previously I linked these two tables with the Year column. I just deleted that link, and reference my time slide to the Year column from the other table. The sequence of the year in my time slide is normal now.
Here is the preview of the year column from my other table. The order of the year is normal, and I believe since I added this column to my time slide, the order of the time slide is normal accordingly.
However, the original year column I showed before is still in the wrong order. This is strange.
Edit 2
If I select the Time Slide extension in edit mode, below is the available under the Dimension. For the Sort by Numeric and Sort by Alphabetical, they both have three options: No, Ascending, and Descending. However, switching between these options does not affect the order of the year in Time Slide.

Related

MDX calculated measures with date comparisons

I'm new of MDX and I'm trying to calculate a new measure based on two different date dimensions.
I have the Creation Date Dimension (with Year, Trimester, Month, Day) and Resolution Date (with Year, Trimester, Month, Day).As measure I have the number of tickets and I want to calculate two new measures in order to know how many tickets that were resolved this month were actually created last month and how many tickets were resolved in the same month as they were created.
I found this interesting post, but I cannot understand how to use properties..
https://bennyaustin.com/2012/06/05/ssas-mdx-calculated-measures-that-require-date-comparison/
Any ideas or suggests?
Thanks for your help.
This question cannot be answered as asked without knowing the exact definition of your time dimensions.
An approach which might be worth considering if your MDX knowledge is little, but you have some SQL knowledge and if your requirements can be fixed to just the month level as you described, could be the following, which does the main calculations already when loading the cube, and not at query time in MDX:
Add a column 'months_from_creation_to_resolution' to your fact table, possibly just add this as a column in the view you may already use on the fact table. This column would be 0 if the ticket was resolved in the same month where it was created, 1 if it was resolved in the month after creation, 2 if it was resolved e. g. in May and created in March, etc. You do this calculation using SQL date functions. You would then create a new dimension in your cube from this table, which would have the new column as the only attribute. SSAS has no problem using a table as base for both a measure group and a dimension.
Then, in MDX, the number of tickets resolved in the month they were created would just be
([Measures].[TicketCount], [Fact].[months from creation to resolution].[0])
and those resolved in the month after creation would be
([Measures].[TicketCount], [Fact].[months from creation to resolution].[1])
As a side effect, the query run time would be faster, as the main logic is pre-calculated when loading the cube.

How to merge two data streams in Alteryx

Alteryx
Table 1 is a google sheet file. It has x fields with primary key.
Every day to that table is added the weekday with the x data
For example:
Monday
Tuesday (is added on Tuesday) and so on.
My problem is that my workflow has a formula that does calculations with all the Weekdays.
Example:
Balance = All_Income - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Sunday
But today for example, in the google sheet data I don't have the other weekdays except Monday and Tuesday, so I get the error "Unknown Variable" for Thursday.
I've inserted a Text Input and added all the weekdays.
I want to (Append maybe) these two data streams together so that I have all the weekdays there.
So if I run the calculations I have all the weekdays there.
Right now that formula works only on Sunday, when all weekdays are inserted as columns.
Any idea how to achieve this?
(p.s Creating the weekdays as columns in the google sheet with empty rows is not an option).
I managed to do it by creating a Text Input with the same column names (headers) as the other Data Source and performing a union.
Apparently I needed to perform a IF statement to check all Weekdays if they exist and replace the null values with.
If anyone encounters the same error, feel free to contact for help :)
Use the Transpose tool to verticalise the days of the week. Then Summarize using the primary key and sum the [value] field. That will give you the balance regardless of which days of the week are present in your worksheet. This technique applies to any problem in which one needs to aggregate multiple fields which may or may not be present or known.
Here is the simplest path to victory:
1. Input worksheet.
2. Connect Transpose tool.
3. In Transpose Key Columns, select only primary key.
4. In Transpose Data Columns, deselect all fields except for days of week and Dynamic or Unknown Columns. This will still work even if the worksheet doesn't have all the days of the week because as they come in, the Dynamic or Unknown Columns option will select them as Data columns.
5. In Transpose Missing Columns, select Ignore.
6. Connect Summarize tool.
7. In Summarize, group by primary key and sum on [Value] field.
From here, you can rename the sum_value field to Balance or something else friendly. You can also use a Join tool, joining on primary keys, to the original worksheet to get back to where you started with the new aggregated value.

How do we calculate difference and percent difference between two columns in tableau

]Difference and percent Difference must be calculated.
I cannot do Apr20-MAy20 because it is not always the same. I need to show the current month and previous month
So I did a relative filter to just show the current month and previous month.
So the difference of two columns should automatically change when the month changes.
Now how do I get the same month of prior year, how do I filter ?
I also need to calculate the difference of current year same month and previous year same month.
Thank you in advance for any help!
When I do table across difference, the difference value is overwriting the existing May and Apr month values as the below screen shot, how to show the difference in another column
Currently:
Below is Expected:
Sounds like you should create a custom filter for the dates. You want:
This month this year
This month last year
Last month this year
There are a number of ways you could do this. I'll give one example and will assume there aren't any future dates in your data set.
[DateFilter]: DATETRUNC('month',[YourDateField])>=DATETRUNC('month',DATEADD('month',-1,TODAY())) OR DATETRUNC('month',[YourDateField])=DATETRUNC('month',DATEADD('year',-1,TODAY()))
Put the to the filters shelf, set to True, and it should keep the months you want.
Then you can just use the standard table calculations to calculate Difference and Percent Difference.
Note, the formula isn't tested, just typed directly into here, let me know if it doesn't work
Based on your comments look at creating separate calculations for to YoY / MoM / etc calculation. That also means creating calculated fields to isolate the Current Month, Previous Month, etc.
For example, the current month:
[isCM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',TODAY())
The previous month:
[isPM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',DATEADD('month',-1,TODAY()))
Then month on month, something like:
[MoM]: (SUM([Measure])*INT([isCM]))/(SUM([Measure])*INT([isPM]))
To make your table check this article about using the placeholder technique to create tables in Tableau

How to get only the first 6 months action of all my records

I'm pretty new in Tableau. I have looked at the forum already and the answered suggested. But I'm not quite sure it match my question.
I have a bunch of records. This is about registration for a sport lesson depending on time. All of them have a start date and and some of them a finish date. The other never finish (They continue until date T with T = now).
My goal is to compare only the first 6 months of all my records, I think there are 50 of them, like the evolution during this period of time. So, for some the start date would be in January 2009, for some other, it would be in May 2016, etc.
As field provided, I have the start date and the number of person that have subscribed those lesson through time.
So, do you if there is any to achieve this goal? Is there enough detail for you to understand what I am saying ?
Thx to you guys !!
EDIT
You can find enclosed a screenshot of the result that I already have.
number of registration for all lesson through time
I'm not sure to be clear, what I try to do is to compare the first 6 months only of each courses. So the evolution of the first 6 months of this course compare to the evolution of the first 6 months of this other course and so on :)
If I understand your question correctly you are wanting to show only the first six months of your data but you want this by each category.
I am assumuming that by definition this means 6 months from the first record in your data for each category.
In order to achieve this I would create a true/false flag using a level of detail expression. As you are new to tableau I would suggest you do some reading on this but basically you can force a calculation to be at a certain level of the data rather than at the row level. You use this to find the minimum date in the table and then use a date diff to return true if the actual date field is within 6 months of this.
Create a calculated field as follows:
[date] <= DATEADD('month', 6, { FIXED [category] :min([date])})
Then drag this onto your filters pane and select "TRUE". This should give you only the first six months of records for each category.
Let me know if you need anything else.

Creating Bins in Tableau for Days in a Week

Could someone please explain me creating BINS based on Weekdays in Tableau? I tried creating different Calculation Fields but it won't work
You're working too hard.
Tableau already knows how to bin values by dates at many levels of granualarity: such as year, month, day, weekday, hour etc. So you don't need to create a new field to bin dates by the day of the week. (creating bins is not difficult, it's just already available in this case)
Just put a discrete (blue) date or datetime field on a shelf. You'll see the date level of granularity displayed like, say, YEAR(MyDateField) with a leading plus sign.
You can either
click on the plus sign to drill down by adding a second level, say MONTH(MyDateField)
or
right click on the field to select the date level of granularity you want
Alex's Answer is exactly correct, Tableau will perform the operation automatically. What is great about is that you can select various formats (Full day name, number, 1 letter or 3 letter day etc.).
However if you absolutely need to you can used this formula:
datepart('weekday',[Date])
to give you the 1 (Sunday) to 7 (Saturday) value if you need it for something other reason, say another calculation.