I want to calculate 2 date fields - archer

I have two fields I need to calculate. Control Procedure Testing Frequency "Auto Quarterly" and Test Due Date value "3/30/22" I want the second value 3/30/22 show on another field Auto Quarterly Due date
If([Control Procedure Testing Frequency]=VALUEOF([Control Procedure Testing Frequency],"Auto-Quarterly"),([Test Due Date]=VALUEOF([Test Due Date],"3/30/22")))

Related

Comparision Calculator in DataStudio

Is it possible to show comparison metric for Google Data Studio Score cards. I want to show mom/yoy change.
I have parsed this "text" column using PARSE_DATE('%B/%Y', column name) and it now shows me unit purchased at the start of each month, I want to show the comparison to previous month but it shows "no data".
How do I put the comparison indicator?
According to your requirement the ‘No data’ error is due to the following possibilities:
1- The one Possibility is with the wrong date column which you might have given in your ‘date range dimension’, You have to provide the Date column which should be in date format , not the one which is in “text” format.
2- The other Possibility is Incorrect comparison date range. When you are providing the data range you have to provide the full set of data for the time Period else it will throw you the error “No data”.
For your second query - Yes you can do the comparison metric in the Scorecard for Month over Month (MOM) as well as Year over Year (YOY)
Steps:
1- Create a scorecard for year1 with filter to choose that particular year only (say for example filter to choose year 2020)
2- Similarly create another scorecard for year2 with filter (say for example filter to select only year 2021)
3-Blend both the scorecards.
4-Customize the ratio.
you can refer to this public documentations also:
No data Error
Date Ranges in Data Studio
scorecards
Blending

SSRS parameters based on selection?

I hope someone could help with this?
I am building a report based on a stored procedure that has the following clause in it
where accountingperiod = #Accountingperiod or createddate between #Startdate and #Enddate
#Accountingperiod will be in the following Format 'Oct 2017'
#Start and #Enddates are just generic date formats.
I basically want my report to load and have the option to select whether the user wants to filter the report using the #Accountingperiod parameter or the date parameter (as both bring back entirely different data). Once the user has selected which one is to be used, the parameters (for example, #accountingperiod) will be available for selection.
How can this be achieved? Apologies if this is a silly question, I am quite new to SSRS!
Thank you
There are several ways to do this. The simplest would be to do it in the Stored Procedure and just test if Accounting Period has been set, if so use that, if not use the date range but that might not be intuitive for the user as they could select an accounting period AND a date range without realising that the date range would be ignored.
The most elegant solution would be to set the start and end dates based on the accounting period and have another entry in your accounting period list called 'Date Range' or 'Any' etc.
This assumes you can lookup or calculate the start and end dates for each accounting period. For the sake of simpicity in this example we'll assume that you have a table (say myAccPeriodTable) with the periods and date ranges in, something like this..
AccPeriodID AccPeriod StartDate EndDate
1 2017-Q1 2017-01-01 2017-03-31
2 2017=Q2 2017-04-01 2017-06-30
3 2017=Q3 2017-07-01 2017-09-30
etc...
Create a dataset (lets call it dsAccPeriods) with the following query
SELECT AccPeriodID, AccPeriod FROM myAccPeriodTable
UNION SELECT -1, 'Use Date range'
ORDER BY StartDate
You Accounting period Parameter (assume this is called #AccPeriodID) Available Values would be from a query and point to dsAccPeriods
The Value would be the AccPeriodID field and the Label field would be AccPeriod
Now create two more datasets say, dsDefaultStartDate and dsDefaultEndDate with the following queries respectively.
SELECT ISNULL(StartDate, 1999-01-01) AS StartDate From myAccPeriodTable WHERE AccPeriodID = #AccPeriodID
and
SELECT ISNULL(EndDate, 2020-12-31) AS EndDate From myAccPeriodTable WHERE AccPeriodID = #AccPeriodID
For your 'StartDate' parameter (assume its called #StartDate) the Default Value would simply point to the dsDefaultStartDate dataset and do the same with #EndDate pointing that to dsDefaultEndDate.
Now when the user selects a start date, the two data parameters should be populated with hte correct dates so your Stored Proc can simply filter based on the #StartDate and #EndDate parameters. If the user chooses the use Date Range option then the default dates will be set to whatever dates you specified in the dsDefaultStartDate and dsDefaultEndDate datasets.
Of course there is a chance that the user selects a real accounting period and then changes the date ranges. There are things you can do to avoid this but one step at a time !
I've written this answer without testing anything so there could be some mistakes but hopefully it will point you in hte right direction. If you have any issues leave a comment.

Creating a calculated column (not aggregate) that changes value based on context SSAS tabular DAX

Data: I have a single row that represents an annual subscription to a product, it has an overall startDate and endDate, there is also third date which is startdate + 1 month called endDateNew. I also have a non-related date table (called table X).
Output I'm looking for: I need a new column called Categorisation that will return 'New' if the date selected in table X is between startDate and endDateNew and 'Existing' if the date is between startDate and endDate.
Problem: The column seems to evaluate immediately without taking in to account the date context from the non-related date table - I kinda expected this to happen in visual studio (where it assumes the context is all records?) but when previewing in Excel it carries through this same value through.
The bit that is working:I have an aggregate (an active subscriber count) that correctly counts the subscription as active over the months selected in Table X.
The SQL equivalent on an individual date:
case
when '2015-10-01' between startDate and endDateNew then 'New'
when '2015-10-01' < endDate then 'Existing'
end as Category
where the value would be calculated for each date in table X
Thanks!
Ross
Calculated columns are only evaluated at model refresh/process time. This is by design. There is no way to make a calculated column change based on run-time changes in filter context from a pivot table.
Ross,
Calculated columns work differently than Excel. Optimally the value is known when the record is first added to the model.
Your example is kinda similar to a slowly changing dimension .
There are several possible solutions. Here are two and a half:
Full process on the last 32 days of data every time you process the subscriptions table (which may be unacceptably inefficient).
OR
Create a new table 'Subscription scd' with the primary key from the subscriptions table and your single calculated column of 'Subscription Age in Days'. Like an outrigger. This table could be reprocessed more efficiently than reprocessing the subscriptions table, so process the subscriptions table as incrementals only and do a full process on this table for the data within the last 32 days instead.
OR
Decide which measures are interesting within the 'new/existing' context and write explicit measures for them using a dynamic filter on the date column in the measures
eg. Define
'Sum of Sales - New Subscriptions',
'Sum of Sales - Existing Subscriptions',
'Distinct Count of New Subscriptions - Last 28 Days', etc

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