how to select data on single click in tableau - tableau-api

I am presently working on tableau worksheets, the data is based on sales and order, it contains months, year, KPI, data value as some of its corresponding fields , what I am trying to do is when any month is selected it should return all the measure and sum of data value of that month as well as all the months before that particular month.

Related

Power BI too current date filter / dynamic bookmark

So I have a sales KPI's page in power bi with 2 full years of data and the current year which is updated monthly / daily, So in order to display data up to the current month we have data for and compare them with prior years I currently have to select all the months individually so for this month I have to make 11 clicks on a month slicer to not be comparing a skewed amount of data with the prior full years..
so my question would be, is there a way to make a slicer or button for an entire page to click just once and show data for only up to the completed dates of data in the current year, just to help efficiency for the end user. I don't want a measure to add to every single visual, just a button or slicer on the page to turn off and on.
I want to stay away from relative date filters that do not update automatically, I don't want to have to go in every month and change it on my end, I want the end user to just push an action button.
Thank you!
You have two options that will fit your use case.
Use the relative date filter, that will show the data for the current year
In this example the relative date filter is set for this year, and will only show the date in that range. The dataset does contain values from 2019 to 2021, but only shows 2021.
The second option is to create a calendar table with items such as 'Current Month', 'Current Year', 'Current Day' etc to drive that filtering if the relative date filter doesn't fit your use case. This example works out the current year
You can set the page filter to filter on items in the current date range, every time the dataset refreshes, it will update the range to take into account the current day, year, month or what ever you define

Sum from/to date

I have 3 tables, one with stocktakes conducted last year, one with stocktakes conducted this year and one with sales. All of them are joined by date to one table where I have dates.
Now the question is what can I do to get table with:
store name/ last year stocktake date/ this year stocktake date/ sum of sales from last year stocktake date to this year stocktake date.
If you choose store, than stocktake date from one table, stocktake from second table all looks good, the problem is that I can't get sales to show from/to.
C2Csales = calculate(sum(PP_SalesLessTax[SalesLessTax]),PP_SalesLessTax[date] >= [ly date])
[ly date] is just a measure with last year stocktake date
I have a feeling that this have to be very easy but have no idea how to get this work
thanks
daniel
please see data model. It is a part of bigger model but I have trimmed it so it is clear what is this about.
data model
And here is what I need. Please see picture.
thanks for all responses
result required
You don't need two tables to simulate years. You can have just one. The idea of last year should be calculated by a measure. If you have a complete date table with a day for each row without missing days then you can build time intelligence.
If I get you, you need something like this two measures:
Sales = sum(PP_SalesLessTax[SalesLessTax]
Sales LY = CALCULATE ( sum(PP_SalesLessTax[SalesLessTax] , SAMEPERIODLASTYEAR ( DatesTable[DateColumn] )
With this two measures you can take both of them on same visualizations to compare them.
The idea of having from and to can be solved on visualizations. The slicer with a date type column can create a range filter data that will apply for this two created measures.

how to get number of days from relative dates filter?

I want to get number of months user selected using Relative Dates Filter?
If user entered "Last 3 Months" then I wants to get number of days for 3 months to use these days in another calculated field.
Calculated field which is using this is as follows.
([Total Sale within Entered Date]/[Number of Days])*365
which returns me predicted sales for the whole year.
Here, [Number of Days] is the filter which I am using. Picture added for Relative Dates filter I am using.
Screenshot of Relative Date Filter:
You need to create a calculated field that works out the number of days in the data.
Something like datediff('day',min([dates]),max([dates])) if data is present for all the days in the time period will work. This calculation will dynamically give you the number of days between the first and last date in the [dates] field for whatever data is selected by the filter (so won't be precise if not all the possible dates are represented in the dataset).

Calendar view in SSRS

I am fetching a stored procedure to the report having two columns as date and non business day. I need to create a year wise calendar for the year which is getting fetched from stored procedure. Each page will have a calendar of a year with 12 months along with days.
Well, you would need a dataset with a Date (Day and Year at least) and a corresponding value for this Day. Then simply add a matrix in your report. For the columns textbox chose the Date (Day) and for the rows textbox chose the Date (Year). In the data textbox use your value. If you load it, it will look like calender because the Days get brocke down by Year.

OBIEE YTD Issues

I have a fact table housing different granularity (date grain)
Monthly
Daily
The month data can be accessed by filtering by end of month date or using YYYYMM date format. In OBIEE RPD repo, the fact is set to LAST Aggregation.
I want to perform Year to Date analysis. And I want to sum only month end dates.
Using function TODATE(Measure), it tends to sum up all the data through out the month e.grain
Date Amount YTD TODate(Amount)
31/01/2106 100 100
28/02/2016 200 300
14/03/2016 50 350*
31/03/2016 100 450
I want YTD to ignore 50 and return 400, so also any other dates that falls within any month. And if if I Select 14/03/2016 I want 350 to return.
Thanks.
Alter the table to add a flag, something that flags Y if the record is at the specified monthly grain, and N if the record is not at the specified monthly grain.
In the logical layer, create two distinct LTSs with the first filtering on the flag for Y. This will be where you will calculate and source all your to date measures. The second LTS can either be filtered to N, or can be left to all the data depending on what you want to do with it.
The performance increases should come from the fact that any month measures you build off that monthly LTS will only hit records flagged as month, and will bypass all that other data that is not relevant. So if a user runs a report only asking for monthly measures, the query will automatically filter to that specific data.
What will happen is if a user selects your to date measure and a specific date measure on the same report, OBIEE should fire off two separate queries to get the data and stitch together based on common dimensions.
Could someone create this in the front end? Probably. You would have to do some sort of PERIODROLLING function, and tell it to aggregate at the month level, but I am afraid it may still roll those days up into a larger than desired number. A TODATE function will not work here.