Date is not refreshing based on the Combo value in SSRS - sql

I have a SSRS report with following fields:
1. Season.
2. Start Date
3. End Date
Whenever season changes, the default date for start-date and end-date needs to be changed. I created a dataset which populate start-date and end-date values based on the season input and assigned the values to Startdate and enddate parameters. In Report, when season selected for first time default-date has changed correctly. But when I change the Season to another value, default-date are not refreshing. What is the problem here?
I have attached the screenshots below. Could someone help me on this?
First Screen-shot shows the default dates for Season 1 (Tax season)
Second Screen-shot shows the default dates for Season 2 (Pre-season) (After Changing Season-1 to Season-2 default date values are not changing )
I found out this issue occurs because the call to data-set is not happened in the second refresh.
Thanks for the help

Your dataset for the dates has to include
SELECT start-date, end-date FROM Table
WHERE Season = #Season
then Default the values for the date parameters to select from the dataset and it will change them when ever you change the season.

Related

How to create a calculated column with unique values ​for every field

I'm currently facing a problem working with a CV on SAP HANA.
Basically my goal is to create a calculated field on every row, based on the content of another field of the same row.
More specifically, I have a column of dates with the current format (YYYYMMDD) and I have to automatically create an associated field based on current criterias:
the date with the current month and year has to be associated with 0;
every month after the current one, has to be, in order, increased by one (example: for 20220930 I have 0, for 20221030 I have 1, for 20221230 I have 3.. for 20231230 I have 15, this until 600);
if more than one row has the same date, the calculated field has to be the same, that means that, for example, if more than one row has 20221030, I need to have 1 on all of them).
My first idea was to use a rank node, but the outcome is not as I expected.
Attached, there is a screenshot of a data preview of my attempt (just showing the dates and rank_field columns..).
Any advice is welcome, thanks.
Example of data

I need to convert total date to month only

I set up a google forms form for my work where my employees pass information and this information is recorded in a spreadsheet. The information, when recorded, automatically inserts a date and time in the first column of form responses. However, when I enter the code = month (a1), it always returns the answer "1" or "January" and this information does not match the date entered in the column. How do I fix this?
If you are entering '=month(a1)' for every row, then you are always taking the month of the top left cell in the sheet. You would need to adjust the row number for the row you are in.
You could use something like '=month(now())' to ensure you are always getting the month of the current date.

Creating a DAX pattern that counts days between a date field and a month value on a chart's x-axis

I am struggling with a DAX pattern to allow me to plot an average duration value on a chart.
Here is the problem: My dataset has a field called dtOpened which is a date value describing when something started, and I want to be able to calculate the duration in days since that date.
I then want to be able to create an average duration since that date over a time period.
It is very easy to do when thinking about the value as it is now, but I want to be able to show a chart that describes what that average value would have been over various time periods on the x-axis (month/quarter/year).
The problem that I am facing is that if I create a calculated column to find the current age (NOW() - [dtOpened]), then it always uses the NOW() function - which is no use for historic time spans. Maybe I need a Measure for this, rather than a calculated column, but I cannot work out how to do it.
I have thought about using LASTDATE (rather than NOW) to work out what the last date would be in the filter context of any single month/quarter/year, but if the current month is only half way through, then it would probably need to consider today's date as the value from which to subtract the dtOpened value.
I would appreciate any help or pointers that you can give me!
It looks like you have a table (let's call it Cases) storing your cases with one record per case with fields like the following:
casename, dtOpened, OpenClosedFlag
You should create a date table with on record per day spanning your date range. The date table will have a month ending date field identifying the last day of the month (same for quarter & year). But this will be a disconnected date table. Don't create a relationship between the Date on the Date table and your case open date.
Then use iterative averagex to average the date differences.
Average Duration (days) :=
CALCULATE (
AVERAGEX ( Cases, MAX ( DateTable[Month Ending] ) - Cases[dtopened] ),
FILTER ( Cases, Cases[OpenClosedFlag] = "Open" ),
FILTER ( Cases, Cases[dtopened] <= MAX ( DateTable[Month Ending] ) )
)
Once you plot the measure against your Month you should see the average values represented correctly. You can do something similar for quarter & year.
You're a genius, Rory; Thanks.
In my example, I had a dtClosed field rather than an Opened/Closed flag, so there was one extra piece of filtering to do to test if the Case was closed at that point in time. So my measure ended up looking like this:
Average Duration:=CALCULATE(
AVERAGEX(CasesOnly, MAX(DT[LastDateM]) - CasesOnly[Owner Opened dtOnly]),
FILTER(CasesOnly, OR(ISBLANK(CasesOnly[Owner Resolution dtOnly]),
CasesOnly[Owner Resolution dtOnly] > MAX(DT[LastDateM]))),
FILTER(CasesOnly, CasesOnly[Owner Opened dtOnly] <= MAX(DT[LastDateM]))
)
And to get the chart, I plotted the DT[Date] field on the x-axis.
Thanks very much again.

SSRS date drill through issue

I have a matrix report called Store Sales which is made up of:
STORES in the row group
DATES in the column group
Sum of SALES in the values group
The DATES column is formatted using the following expression:
=format(Fields!DATES.Value, "MMM yyyy").
The matrix report also has 2 parameters #Start and #End. This all works great but I then added a linked report (Sales Store Details) so that the user can click on the SALES value for any purchase by month and store. The linked child report (Sales Store Details) uses the #Start and #End parameters from the original report (plus an additional #Store parameter) but this is where I run into problems. Rather than bringing me the purchase details for a particular store and month it brings me back everything from the time period selected from the original date parameters. So say I originally selected 2015-01-01 to 2015-06-30 with the #Start and #End parameters from the Store Sales report. When I then select on my FEB 15 value in my matrix report the drill down linked report doesnt just give me Feb 15 data but all the other months data too ie Jan-Jun 15. I understand that the original report parameters specified the Jan-Jun 15 date period but surely when I select on the Feb value in the matrix report that's what my linked report should drill down too right?
Any help would be really appreciated.
It sounds like you're passing the original #Start and #End parameters from the parent report. If so then you're passing the original date filtering parameters so it shouldn't be surprising that the date filtering on the child report is the same.
If you want to limit the child report's date filtering to only the month of the row being clicked you'll need to pass through the date value for that row instead of the original parameters. I'm not sure how your data set is structured but I assume there is some date column you use to determine the appropriate filtering to use.

ssrs dynamic value in text box and title

I have a report which runs weekly and in one of the tables it says week1, week2 etc all the way to the recent week (e.g. week28 currently)
This table is in the report and I would like the week28 value to be in the title. The title reads "summary report for" I want to place the week number at the end so every week the report is run it changes.
There are also a couple of other places I would like to place the dynamic value but i'm guessing the code will be the same.
Assuming you have a sorted dataset called "MyDataset" with a column that contains the week names called "Week", you could simply use the following expression:
=Last(Fields!Week.Value, "MyDataset")
This returns the last value in the Week column of MyDataset.
Alternatively, you could construct the week number using some of the date functions, for example the datepart function