Converting a measure to date for line chart in Tableau - tableau-api

I am trying to convert some measures that I have into dates for making a line chart. This is the data I have.
[
I am trying to make a line chart out of this data. But I cannot put it under a date since there are no dates in the dimensions. Any help would be appreciated.

You will need to some how reshape this data to create a single date field. You can do that out of Tableau or perhaps use Tableau prep. Your underlying data source is likely to drive that decision, you don't mention anything about that in your question.
Edit from comments:
Connect to the spreadsheet in Tableau. In the Data Source window, where it shows you all of the data in a table, select the 4 fields starting with Tuition and Fees. Then click on the drop down and Pivot those fields.
That will create 2 new fields, Pivot Field Names and Pivot Field Values.
In your workbook create 2 new calculated fields:
[FeeYear]: LEFT(RIGHT([Pivot Field Names],7),4)
and
[FeeDate]: MAKEDATE(INT([FeeYear]),1,1)
You can use FeeDate as the x axis of your line chart. Pivot Field Values is the measure to use in your line chart.

Related

How to filter by current month automatically on pivot table google sheets?

As a data analyst, I would like to see the report in a pivot table automatically for the current month, so that I can take a look at it and don't have to change the date filter manually.
This is the formula to show the first day of the current month. (Which is the criteria I need, first of the current month)
=EOMONTH(today(),-1)+1
It works when I put this formula in any cell.
But when I put it in the pivot "filter by condition" option it doesn't work.
This is what I tried.
Text is exactly =EOMONTH(today(),-1)+1 (In formula box)
The date is exactly =EOMONTH(today(),-1)+1 (In formula box)
Here a screenshot of the options
Any help will be greatly appreciated.
I've never had great luck with the pivot table filter criteria in Sheets, I typically filter the data first if it's more advanced or use aggregating functions. In the Sheets pivot tables are better for quick analysis than dashboards.
There's probably a few ways to do it, but one of the easier ways would be to duplicate the data tab, clear the data and use a filter function to retrieve data. Update the Pivot table data source to the new tab. This will always only be the current month's data.
Basically you filter the data before the pivot table, with the [filter function][1].
=Filter(data , [date col]>=EOMONTH(today(),-1)+1 , [date col]< date(year(today()), month(today())+1,1)
You can also add a month column to the data and then filter on that column, however each month you would need to update the month filter in the pivot table.
=date(year([date cell]),Month([date cell]),1)
If you're using it for a 'dashboard' of sorts, I would generally recommend to create it yourself with aggregating formulas (sumifs, countifs, ect) and then you can use the more complex filters.
try custom formula:
=MONTH(A2)=MONTH(TODAY())
where A2 is first cell of column containing valid dates
You can try to Filter by a Custom Formula:
=month(DatePurchase)=month(TODAY())
Where DatePurchase is the Field Name.

How Do I generate Line Graph in PowerBI for the following Data

The Data I have looked like the Image below:
I want to create a line Graph,
The x-axis will have the Months (January to June), Y-Axis will have the Tot_QtY.
Considering that the date information is not in a single column but is spread out to multiple columns, How do I make a line chart.
Output I am getting is shown below:
The Output I need would look like this:
your input data is not correct, you need to model it so you get one column with rows of data. Click Edit Queries, this opens query editor.
Click tab Transform, select your columns and click unpivot.
My expectation is that you still need to work a bit more on your data because how the system knows from a column: MayDATE. that you talk about May. The best base data you can have is a column date and a colum value with data.

Tableau creating a calculated percentage (non-aggregate) based on an aggregated total

Either I am the first person to ever need to display percentages in Tableau or I do not know what to search for! I highly suspect it is the latter...
I believe what I am attempting to ask is how to make a calculated non-aggregated field by dividing by an aggregated number. Although I would prefer just to be able to display the percentages instead of a whole number.
This is how I would do it in Excel:
The data that already exists is Column A and B. In Tableau these would be non-aggregated. What I need to do in Tableau is to generate what is column C (also non-aggregated) because it does not exist in my data. In excel, all I did to get the aggregate number (total) of column B was:
sum(B1:B4)
And for the column C:
=B1/$B$5
But I can't seem to do this at all in Tableau. When I try to use the same syntax, I get an error message: "Cannot mix aggregate and non-aggregate arguments with this function."
Instead of having a calculated field, you can use a Quick Table Calculation on the column.
Right-click the pill of your data > Quick Table Calculation > Percent of Total. This will show the percentages instead. If you want to keep both, just duplicate column b first and then add the table calculation to the new column.

Group by first two characters of column, in Tableau?

I'm using Tableau Desktop v9.0. I have data that looks like this:
code,items
02050252,7
03040620,19
03060423,3
I want to create a bar chart of the items grouped by the first two characters of the code field.
So effectively a chart that shows this underlying data:
new_code,items
02,7
03,22
Is it possible to do this within Tableau? Or do I need to group the data manually myself first?
You can definitely do this within Tableau.
Make sure that your code column is a string. If it's not, right click on it in the dimensions section and choose Change Data Type.
Then, create a calculated field (Analysis -> Create Calculated Field) and enter the expression LEFT([Code], 2), which will take the first two characters of the code field.
Drag your new_code field to the Rows shelf and Items to the Columns shelf and voila, you have your desired data. You can of course change the type of the chart, make it a table, etc. from here.

Named ranges in google spreadsheet charts?

Edit: This question relates to the "old" google spreadsheets that were current in 2013.
Is it possible to use named ranges in google spreadsheet charts?
I need to dynamically update the dimension (starting position and size) of a range and be able to reflect it in a chart, i.e. I need the chart source range to follow the position of moved source data range.
Extra information:
I've got two sheets. One has a header followed by 'input' row and data rows. When I type anything into 'input' row my script automatically adds a row just after this one and moves my new input there, therefore creating new row of data.
About chart: If I assign a data range that includes only data rows, new row won't be included because whole 'old' range got shifted. $ sign is ignored when specifying data range. So what I'm doing is to include in the range my 'input' + 1 header row. They have no values so in the chart you cannot see data points in the first two positions. I'm using a combo chart with another range from another sheet that has no header, so it looks like this:
(usually there is some value for the green histogram right at the origin of the chart).
So the line chart is shifted by two positions to the right, but it should start from position 0, so I want the chart to somehow follow the range or to redefine it, so it always stars from the first data row. I hope it makes sense.
Charts use range as argument, have you tried to simply use getRangeByName to define the range ?
Charts don't support named ranges. However, you can set up your chart so that the source data range is an entire column (for example, Sheet1!D:D). Then the chart will show all the values in that column, taking into account even rows that you will add (or delete) after chart creation. If the first rows (for example 4) contain table headers you can specify something like Sheet1!D5:D as your source data range
In searching for this, I found a solution I thought I'd share.
I have a set of data from which I'd like to create a set of charts. My fairly simple workaround was to create a new tab for each chart with a pivot table to pull in my data based on my criteria for each chart. I inserted a row at the top to hold a SUM of my values in the pivot table below, rather than referencing the moving "Total" cell in the pivot table itself.
Note: I hid the title row of the pivot table and unchecked the "Totals" within it to get the SUM to work correctly. Hope this helps someone!