RDLC report column value decided on the base of other report column text - rdlc

I want to hide/replace the text on the decision of column value.
I have two columns which will show the value of rate and second column value will be sponsorship or unsponsored.
In case of sponsorship, rate, date from and date to will be shown the value and if sponsorship type will be unsponsored then it must shown nill on the place of rate, datefrom and date to column.
Sponsorship type can have one of two values:
sponsored
unsponsored
If sponsorship type will be "sponsored", then it will populated/shown the value of column rate, datefrom, dateto
If sponsorship type will be "unsponsored" then rate, datefrom, dateto value will be replace with nill

Related

select data from range of two dates

I want a query for selecting data between two dates (p_startdt,p_enddt) which is given by the user, if there is no input then by default data of last one year will be given as output. I am not able to put case for null or no input
where invc_dt between p_startdt and p_enddt
Use NVL to handle the case of a NULL value. The following example will take start date as a year ago if p_startdt is null and p_enddt as the current date if p_enddt is null:
WHERE invc_dt
BETWEEN NVL(p_startdt,ADD_MONTHS(SYSDATE,-12)) AND
NVL(p_enddt,SYSDATE)
Note: I'm assuming the data type of the column invc_dt is DATE.

Sort Gregorian date in Power BI

In power bi, I have a date table containing gregorian date and solar date since 1970. how I can sort the solar month? or how can I sort slider containing alphabetic other than English?
If you wants your Month name to order in the slicer alphabetically (like first A then B.... finally Z), rather than using Month value, you can create a Custom column in your Date table with Month name for each date.
Once you created the new Custom column in the source, change the type to Text/General. Now create your Month slicer using this new Custom column. This will now show the month names using alphabetic order.
You can use both DAX and Power Query to get the month name from a Date value.
DAX: MonthName = FORMAT([Date],"mmmm")
M/Power Query: MonthName = Date.MonthName(date_column_name, "en-US")
Finally convert the data type as Text/General.
Process of creating new custom column
Right click on the Date table and select New Custom Column as shown in the below image-
Now put the DAX code and change the data type as shown in the below image-

Date is not refreshing based on the Combo value in SSRS

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.

Date/Time data types and declaration in SQL Server

I would like to have a date and time column in my table. The main purpose of having these 2 columns is to be able to return query results like:
Number of treatments done in the period November 2011.
Number of people working in shifts between 00:01 and 08:00 hours.
I have two tables, which have the following attributes in them(among others):
Shift(day, month, year)
Treatment(start_time, date)
For the first table- Shift, query results need to return values in
terms of (ex: December 30,2012)
For the second table, start_time needs to have values like 0001 and
0800(as I mentioned above). While, date can return values like
'November 2011'.
Initially I thought using the date datatype for declaring each of the day/month/year/date variables would do the job. But this doesn't seem to work out. Should I use int, varchar and int respectively for day, month and year respectively? Also, since the date variable does not have component parts, will date datatype work here? Lastly, if I use timestamp data type for the start_time attribute, what should be the value I enter in the insert column- should it be 08:00:00?
I'm using SQL Server 2014.
Thank You for your help.
AFAIK it is better to use one column by type of DateTime instead of two columns which hold Date and Time separately.
Also you could simply query this column either by Date or Time by casting it to corresponding type :
DECLARE #ChangeDateTime AS DATETIME = '2012-12-09 16:07:43.937'
SELECT CAST(#ChangeDateTime AS DATE) AS [ChangeDate],
CAST(#ChangeDateTime AS TIME) AS [ChangeTime]
results to :
ChangeDate ChangeTime
---------- ----------------
2012-12-09 16:07:43.9370000

SQL query for finding a value in multiple ranges

i have MySQL db that contains event's date and 3 ranges, i.e from1-to1, from2-to2, from3-to3
each range has different price, i.e from1-to1 rate1 , from2-to2 rate2, ...
so that's 3 columns for each range: from, to and rate.
i'm trying to find the query that returns the rate for a given month, meaning finds the range that the month is in and returns the rate of that range.
any ideas?
thanks!
If you make an extra table just for the ranges you would keep your schema in normal form and you could easy select the right rate: TABLE range, COLUMNS from, to, rate. With a foreign key linking to your original table. Then you could SELECT rate FROM range WHERE 'date' >= from AND 'date' <= to.
It seems like your data model is not normalized. You should consider morjas suggestion about creating an additional table.
Below is a really ugly query that checks whether a date is in any of the three ranges, and then returns the matching rate.
select case
when date '2010-12-05' between range1_from and range1_to then range1_rate
when date '2010-12-05' between range2_from and range2_to then range2_rate
when date '2010-12-05' between range3_from and range3_to then range3_rate
end as rate
from events
where date '2010-12-05' between range1_from and range1_to
or date '2010-12-05' between range2_from and range2_to
or date '2010-12-05' between range3_from and range3_to;