I have dimension as date, --(Date has discrete dates- some dates from this months , some dates from last and so on - with data.)
more dimensions are : Team name & Team ID
other dimension is Result.
Result column has value : pass or fail ---only two values.
below data gets refreshed everyday.
date Team name Team ID Result
24/07/2008 lol 458 pass
27/01/2017 pop 1478 fail
28/02/2018 laugh 99 pass
and so on
I want to show dates on x axis, Result : Pass or Fail on trend-lines .
what would be my Y axis?
Want to show pass or fail team ID wise on trend lines!
If its December month then team ID which have passed /failed for 31st of December 2017 should show up.
similarly for Jan month (team ID ) which have passed or failed should show of 31st jan 2018.
AND for Feb month it should show pass / fail for current date --- {Team count pass or fail for particular current day}
please help with calculated filed calculations
Try This:
if Date= today() then 1
elseif dateadd('day',-
day(DATEADD('month',1,Date)),DATEADD('month',1,Date))=Date then 1
else 0
than set filter to 1
Related
I am trying to find a way to display the rolling 12 month sum of the last 12 months. My table is called CV_Spend__R2:
Year and Month come from a date hierarchy from the same table while Profit is a calculated measure (SUM) of that particular implicit measure. R12 is the rolling sum of the last 12 months contained in the dataset:
R12 = CALCULATE(SUM(CV_SPEND_R2[Profit]),
DATESBETWEEN(CV_SPEND_R2[EOM].[Date],
NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE(CV_SPEND_R2[EOM].[Date]))),
LASTDATE(CV_SPEND_R2[EOM].[Date])))
So far so good. Now the measure TTM should show me the same value as R12 but only for the last 12 months from a month/year date that I select. For this I created a separate date table with no relationship with the model:
DATE = CALENDAR(MIN(CV_SPEND_R2[EOM].[Date]), MAX(CV_SPEND_R2[EOM].[Date]))
For example, I want the TTM to show only the R12 values for March 2019 to March 2020 if March 2020 is selected as in the end R12 needs to be removed from the table.
I somehow managed to make this dynamic, but it is not working correctly and I am at wits' end. This is what I came up with:
TTM =
VAR CurrentDate = MAX('DATE'[Date])
VAR PreviousDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate)-12, DAY(CurrentDate))
VAR Result1 = CALCULATE([R12], FILTER(CV_SPEND_R2,CV_SPEND_R2[EOM] >= PreviousDate && CV_SPEND_R2[EOM] <= CurrentDate))
The problem with this is that it displays the correct months dynamically, but then it breaks down the the R12 value into the twelve months it contains in the interval, basically rolling back my efforts. If I add the TTM value on a card it shows the correct value for that month. I have tried other options with DATESINPERIOD, DATESYTD and DATESBETWEEN, but they either aren't dynamic to show only the last 12 months based on my selection, or they don't show the desired values.
I have also tried:
TTM =
VAR CurrentDate = MAX('DATE'[Date])
VAR PreviousDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate)-12, DAY(CurrentDate))
VAR Result5 = IF(MAX(CV_SPEND_R2[EOM].[Date])<=CurrentDate && MIN(CV_SPEND_R2[EOM].[Date])>= PreviousDate,[R12])
The problem with this is that when I try to display it in a stacked column chart with TTM and [EOM] on the axis, nothing is displayed because it does not accept TTM in the chart, and the chart is my ultimate goal.
Can you please assist me with a solution for this? How to display only 12 months of rolling 12 months' sum from a selection? Please mind that in this example the March 2019 value also needs to be the sum of its previous 12 months, because I already found a solution to start the rolling 12-months sum in the dynamic interval (i.e. March 2019 = 1.028 bn), but this is not what I need. I want to see the R12 value for the 12 months in the TTM column so that I can display it in a stacked column chart later.
Thanks a lot.
After a quick look at your measures, it looks like you only need to slightly modify one. Replace table name in FILTER to ALL(CV_SPEND_R2)
TTM =
VAR CurrentDate = MAX('DATE'[Date])
VAR PreviousDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate)-12, DAY(CurrentDate))
VAR Result1 = CALCULATE([R12], FILTER(ALL(CV_SPEND_R2),CV_SPEND_R2[EOM] >= PreviousDate && CV_SPEND_R2[EOM] <= CurrentDate))
I would like to make a calculation to get the difference between the departDate from my current row and the arriveDateNextStop from my previous row. I have a fact table which has multiple columns. The three most important columns are: id, departDate, arriveDateNextStop.
If I have for example these two rows in my fact table:
id departDate arriveDateNextStop
1 01-01-2019 03-01-2019
1 04-01-2019 07-01-2019
Explanation: On 1 January 2019 I depart to the next destination and I arrive there on 3 January 2019. On 4 January 2019 I again depart to the next destination and I arrive there on 7 January 2019.
Now I would like to know how many days the idle time was (the amount of days between the arrival and the next depart). So with this example the idle time would be 1, because between 3 January 2019 and 4 January 2019 is one day.
First, I made this 'calculation' in Management Studio as a SQL query. See query below:
SELECT s.Id, s.departDate as Depart_current_place, s.arriveDateNextStop as Arrival_next_stop, LAG(arriveDateNextStop) OVER (ORDER BY arriveDateNextStop) AS Arrival_current_stop, DATEDIFF(DAY, LAG(arriveDateNextStop) OVER (ORDER BY arriveDateNextStop), departDate) AS Amount_of_days
FROM MyTable s
WHERE Id = 9
GROUP BY s.departDate, s.Id, s.arriveDateNextStop
ORDER BY s.departDate
This query works fine, but how can I do this in my cube as a calculation in MDX?
I don't have the same example, but the similar cube structure with Completed/Received date:
with
member departDate as [Received].[Year Qtr Month].CurrentMember.Member_Key
member arriveDate as [Completed].[Year Qtr Month].CurrentMember.Member_Key
member arriveDateNextStop as [Completed].[Year Qtr Month].CurrentMember.Lead(1).Member_Key
member idleDays as departDate-arriveDateNextStop
SELECT NON EMPTY { departDate,arriveDate,arriveDateNextStop,idleDays } ON 0
, NON EMPTY
{ ([Completed].[Year Qtr Month].[Date].ALLMEMBERS
* [Received].[Year Qtr Month].[Date].ALLMEMBERS ) } ON 1
FROM ( SELECT ( { [Completed].[Year Qtr Month].[Date].&[6213] } ) ON COLUMNS
FROM [MyCube])
I also have integer key for a date dimension (CurrentMember.Member_Key). 1 = 1998-01-01, 2 = 1998-01-02 etc. till today. You need to create a property in a Date dimension if your Date key is classic YYYYMMDD (which you cannot subtract to get days difference, I can do that in my example). And use it like CurrentMember.Properties("property name") instead of Member_Key.
Main formula part: Lag/Lead function to get prev. or next member.
Please update in case of questions.
I have created a graph to show 6 months moving average column for last 13 months
Now users want to drill on these 6MMAs for last 6 months data contributed to that moving average.
Say , for Mar 2016 the contributing months are 10/2015, 11/2015, 12/2015, 01/2016, 02/2016 and 03/2016.
So when user clicks on Mar 2016 data point they should see all contributing projects for that month i.e. 10/2015, 11/2015, 12/2015, 01/2016, 02/2016 and 03/2016.
For Feb 2016 the contributing months are 09/2015, 10/2015, 11/2015, 12/2015, 01/2016 and 02/2016.
So when user clicks on Feb 2016 data point they should see all contributing projects for that month i.e. 09/2015, 10/2015, 11/2015, 12/2015, 01/2016 and 02/2016.
And so on..
How can I achieve this?
Create one more analysis which will show data for all months/year.
And create a drill down from your master report which will be navigated to the detail report .
Also on what column basis you want to display your detail report ,give "column as prompted " there.It will be like "Master-Detail" analysis.
So when you will click on master report,that value will be passed as a parameter to detail report through "is prompted".And required value will be displayed.
PFB the link for detail explanation.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi1113/actionframework/actionframework.htm
Hope it is helpful.
you can try a work around.write a formula in your month column in your detail report. --Extract year from the presentation variable and month should be latest value of the month column and (month-5).Try with this. Try to create the detail report which will basically show the last 5 months data.and pass the variable accordingly. – mona16 12 mins ago
try some thing like this in your date column in detail report. use filter on you date column Time.Date <= cast(current_date as date) and Time.Date >= TIMESTAMPADD(SQL_TSI_MONTH, -3, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
I have a pretty awkward setup in SSRS with custom grouping options (i.e. by office, seller, buyer etc.). In example, user can group items by year and then by month. The outcome of the report is then:
Gr1. | Gr2.
2015 | April
2015 | August
2015 | February
2015 | January
and so on...
So both columns are alphabetically ordered, which works excellent for all custom grouping options but months - which should have their own logic for sorting. How could I implement that?
You should try to return all information form the database in its native type. Instead of returning the month names as ‘January’, ‘February’ etc, it would be better to return 20150101, 20150201 for example (or whatever the default date format is for your environment)
You can then alter the format of the type in the report. For example, set up the cell to return
=MonthName(Month(Fields!myDate.Value),False)
To return the name of the Month for any date. SSRS will then know when ordering how to put the dates in the correct order.
ALTERNATIVE
Assuming you do not want to edit the way the data is returned, you can use a Select statement in the code behind your report to manually provide an order for the months.
Supposing the Dataset
Month Val
---------- ---
January 1
February 2
March 3
When sorted by Month returns the following
Instead, insert the following code to your report (right click the report area, select Report Properties, then Code)
public function MonthNumber(MonthName AS String) AS Integer
Dim MonthNum AS Integer = 0
Select Case MonthName
Case "January"
MonthNum = 1
Case "February"
MonthNum = 2
Case "March"
MonthNum = 3
End Select
return MonthNum
end function
Then set the Group Properties to be Sorted on
=Code.MonthNumber(Fields!Month.Value)
Gives the following result
This is because when ordering the set, instead of just looking at the name of the report, it passes the name through the Code, which is effectively telling the report which number to assign to each month. It is then ordered on this value instead of the month's name.
Hopefully this is useful to you. If you have any further question please let me know.
I have a yearly chart that it broken down into the 12 months Jan - Dec. The report contains various parameters including a yearly dropdown that changes the chart and report.
This all works fine within the first report.
The problem is that I have set up an action on the chart to go to a second report with a monthly breakdown, so my question is how can I pass the monthly value from the first report to the second?
The monthly report has an additional date from and date to parameter, so for the month of January it would need the values: Date From: 01/01/2010 and Date To: 31/01/2010 for example.
Thanks in advance.
Since you have the year and month integer values, you can construct the start and end dates to pass to your other report using expressions.
The start of the month will be:
=DateSerial(Fields!Year.Value, Fields!Month.Value, 1)
Where Year and Month are the integer values from the Chart/Dataset.
The end date is a bit more complicated; since the day part can be 30/31, etc, but we can just add one month to the above expression to get the first of the next month, then go back a day:
=DateAdd(DateInterval.Day
, -1
, DateAdd(DateInterval.Month, 1, DateSerial(Fields!Year.Value, Fields!Month.Value, 1)))
This way your drillthrough report can get its date based parameters and you don't need any changes to your dataset/parent report.