IIF Date falls BETWEEN two dates using SSRS - ssrs-2016

I am using SSRS 2016 and trying to compare a field to check if the Month falls between two parameters, as following:
=IIF(Format(Fields!FromDate.Value, "MMM") BETWEEN (Format(Parameters!FromDate.Value, "MMM") && (Format(Parameters!UnilDate.Value, "MMM") ), Fields!Days.Value, "0")
I have manually setup some fields in the dataset to display Jan to Dec. The aim is to show each result in its relevant month when you select the parameters: FromDate and UntilDate
What am I missing here?

I just replicated your scenario on my local report project.
Below is the expression you should try.
Note: What happens when your From date is June 2020 but To date is Aug 2019.
This will work because we are only checking months in between but not Years and so on.
But this should be a starting point for you to update your logic.
=IIf(Format(Fields!FromDate.Value, "MM")>= Format(Parameters!FromDate.Value, "MM")
and Format(Fields!FromDate.Value, "MM")<=Format(Parameters!UnilDate.Value, "MM"),
Fields!Days.Value,"0")
Edit for only current Year
=IIf(Year(Fields!FromDate.Value)>=Year(Parameters!FromDate.Value) and Year(Fields!FromDate.Value)<=Year(Parameters!UnilDate.Value) and Month(Fields!FromDate.Value)>=Month(Parameters!FromDate.Value) and Month(Fields!FromDate.Value)<=Month(Parameters!UnilDate.Value) , Fields!FromDate.Value,"0")

Related

Excel - count a specific value based on a part of another cell

I thought this would be a no brainer. But I really need help to solve it.
I have a row of dates: 10 july 2020, 11 july 2020 and so on (Swedish excel).
Below each date are strings for example "FP". I wish to achieve a counter for each "FP" that is below a specific month of a year, such as july 2020.
The way I approached this was with
=COUNTIFS(G1:UG1;"*july 2020";G2:UG2;"FP")
However the * doesn't do what I want it to. Is there another way to do this?
Please help! :)
The dates are true dates and as such the july 2020 is just a format of a number and not actually there.
Instead BookEnd the date:
=COUNTIFS(G1:UG1;">="&DATE(2020;7;1);G1:UG1;"<"&DATE(2020;8;1);G2:UG2;"FP")

Returning a Financial Year & Quarter date in Excel

I would like Excel to be able to return the related Financial Year and Financial Quarter of a particular date. i.e.
Date
1st April 2020
Financial Year
20/21
Quarter
Q1
Our financial year begins from 1st April (not 1st January) and the quarters fall from that date.
What equation can I use in Excel to make this work?
Please see below table denoting what a financial year looks like for us and the relative 4 quarters.
Thank you
David
Quick and dirty (can be simplified):
Financial Year:
=IF(MONTH(B1)>=4,RIGHT(YEAR(B1),2)&"/"&RIGHT(YEAR(B1),2)+1,RIGHT(YEAR(B1)-1,2)&"/"&RIGHT(YEAR(B1),2))
Quarter:
="Q"&IF(ROUNDUP(MONTH(B1)/3,0)-1=0,4,ROUNDUP(MONTH(B1)/3,0)-1)
You can try using for Financial Year:
=IF(MONTH(B1)>3,YEAR(B1)&"/"&YEAR(B1)+1,YEAR(B1)-1&"/"&YEAR(B1))
& for the quarter:
="Q"&CHOOSE(ROUNDUP(MONTH(B1)/3,0),4,1,2,3)

Auto - sorting date in microsoft Excel 2016

I'm trying in excel something very simple but the answer seems more difficult?
At work we created an excel file and from left to right we can fill in details.
For example:
Date EmployeeName Status Comments
But I want that all cases are being automatically sorted by date. And then from the date of today and future ( explain this later at second ).
So for example today is 27 march 2020.
Case1: 1 april 2020 / EmployeeName / Status(open) / commments
Case2: 2 april 2020 / Employeename / Status(closes ) / comments
Now I fill in a new date lets say 29 march 2020. This should automatically pop up above 1 April 2020. However you need to manually click on the sorting table.
Second what if there are cases from before 27 march ( today's date ) can you make them disappear to the bottom of the list? Or in another tab in excel?
I believe that the easiest solution would be to write an if(...) statement to fulfill those terms in moving the selected dates. For sorting the dates I would recommend to have the date format in dd/mm/yyyy. So it would read 27/03/2020, instead of 27 March 2020. I find the default sorting of excel to work better with the number sequence in that format when sorting (ascending and/or descending) dates.

Pivot table not comparing January current year to December of previous year/Excel 2013

I created a pivot table from data that spans from 1/1/2013 to 8/31/2014. I have a column to compare the difference from previous month, but it will not return a value for January 2014 compared to December 2013. I have searched for the answer but was unable to find anything that actually resolved the issue. Any help is greatly appreciated.
The data feeding the pivot table is structured something like this.
UNIQUE_IDENTIFIER DATE MONTH YEAR REVENUE
The structure of the pivot table is YEAR and MONTH in the "ROWS" section. Revenue is summed up in the value section. Next, I have the sum of revenue calculated as a percentage difference from previous month. Then I have sum of revenue calculated as a percentage difference from previous year.
I know this question was asked almost three (3) years ago but I have came across the same issue recently.
How I solved the problem:
Added another Column called MonthID. This basically giving months from previous years an accending number
2016 Jan to Dec = MonthID: 1-12
2017 Jan to December = MonthID: 13-24
Used MonthID in the Rows Section
Set Value to % Difference From using MonthID

How to exclude the February 29 - Leap Year in a Date column using Cognos 10 Report Studio?

How do I exclude the February 29 - Leap Year in a Date column in Cognos 10 Report Studio?
This is the column that I'm using for my date prompt
Below is the prompt that I applied on the date column
Depicted below is the details and properties of the date prompt that I will use to filter my report using the date prompt.
So all attributes and measures in the report are filtered using the start date and end date of the expiration date column I used on the report.
How do I avoid the February 29th to add up in my calculated columns (measures)? I want to get all calculation from January 1 to Dec 31 without february 29 that happens every four years? The February 29 data may or may not include a large amount but it has a ripple effect at the year end calculation. That's why I want to exclude Feb 29 included in the computation.
Here's a filter expression that will exclude "leap days":
not (extract(month,[Policy Expiration Date]) = 2 and extract(day,[Policy Expiration Date]) = 29)
Kindly try this.
([Policy Expiration Date] between ?Expiration Start Date? and ?Expiration End Date?)
AND
to_char([Policy Expiration Date],'mmdd') <> '0229'

Resources