Microstrategy: With a drop down box Year, how to show values of the selected Year and Previous year in a grid - sql

With a drop down selector 'Year' attribute (All is disabled), how to target a grid report to show values of the selected Year and Previous year?
For example:
User selects year '2012' from the drop down,
the grid should display values of metrics for year 2012 in one column
and 2011 in another column for comparison purpose.
Metric headers are rows and year attribute is column.
Please note, the dataset is created with freeform sql.
Thank you in advance

This can be achieved using transformations in MicroStrategy. Please go through the link for more details.
Link to MicroStrategy Community
However, As you have mentioned that you are using a free form SQL, In this case write another pass of SQL like below and join result of this pass with original pass of SQL using Year column.
Select Fact.Year, Sum(Fact.Metric)
From Fact JOIN Lookup
on (Fact.Year = Lookup.Year - 1)
Group by Fact.Year

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

Dynamic column selection in Excel

I have a table in excel with months as columns and couple of rows with data. I would like to add a column on the end of the table that will populate with data from the table as the YTD sum of the month columns. The YTD sum will be based on dynamic selection of the month selected from a list. Have a look at the attached image to see what I mean please, in the example Aug-16 has been selected in column P and the YTD total is returned correctly for this period (this is what I want to happen, but not sure how to?:
enter image description here
The dynamic selector I can do fine (Data validation -> list) but I'm not sure how to populate the column with the correct data, that is YTD for the month selected in the dynamic column added. Not sure if it can be done with MATCH, INDEX etc? I tried, also VLOOKUP, but not working....
One solution is to use this formula using the same parameters as your example image.
=SUM(C3:OFFSET(C3,0,MATCH($P$2,$C$2:$N$2,0)-1))

SSRS Expression to Populate Parameter Dropdown Based on Date

I'm currently struggling with how to produce a Fiscal Year parameter, so its values start with Current year, but also contain records from all previous years, and then have all following values be each following year.
So the Fiscal Year would look roughly like the following
Current (I would want to include all previous Fiscal years in this as well),
F18,
F19,
F20,
etc. etc.
As of right now, I have all fiscal years on the drop down, starting with the earliest fiscal year that exists in the database using the following query to populate the parameter dropdown.
SELECT DISTINCT FiscalConsideration FROM dbo.Currency
Which would look like this
F12,
F14,
F15,
F16,
F17,
F18,
etc. etc.
Then I filter the results based on the selected Fiscal year.
Question 1
Is there a way where I might be able to do this, have all records from current fiscal year and prior on one value and all individual fiscal years after?
Question 2
I have also discovered that I can't have this be multi-select AND accept NULL's as well. Might I be able to convert nulls to a custom string or something and have that be an option as well?
I ended up doing it by incorporating more of the logic I wanted into the computed column in SQL Server Management Studio with another case when for past records, and changing nulls with isnull to 'TBD'

Matrix to show all months of the year

I have a Web Service that I am getting data from (Not mine and I can't change it)
The data is in the following format
<DealMetrics>
<DealId>1</DealId>
<DealName>ABC</DealName>
<FundAbbreviation>ABC</FundAbbreviation>
<NavYear>2012</NavYear>
<NavMonth>January</NavMonth>
<Nav>123</Nav>
.
.
.
</DealMetrics>
I have a matrix that displays this performance data and works fine - I have a row group on the year and a column group on the month. The problem occurs if a deal has only been running for a short time - I want to display all months regardless of whether we have any data - So for example if a deal started in September and we're in December I'd want the column headings to display for Jan - Aug as well as the data that is returned in the web service.
Any ideas?
Regards
Andy
Might not be the most elegant way of doing it (I'm a relative newbie to SQL!) but I would create a table which is effectively a calendar of all the months within the period you are interested in (using a recursive CTE) and then just join the results of the query from the web service onto that?
Assuming your metrics end up in a SQL Server table with the following columns:
-- Metrics table:
DealId
DealName
FullAbbreviation
NavYear
NavMonth
Nav
Create a calendar table to hold all years and months you could possibly be interested in. For instructions on how to create a calendar table, check out this post, for example: How to create a Calender table for 100 years in Sql
Then, when you have your calendar table, use it in an outer join with your metrics table, so that you get all your years and months from the calendar table, and the metric data (if any). The query in your dataset could for example look like this:
SELECT DealId,
DealName,
FullAbbreviation,
ISNULL(NavYear, Months.Year) AS NavYear,
ISNULL(NavMonth, Months.Month) AS NavMonth,
Nav
FROM
(SELECT DISTINCT Year, Month, MonthNumber FROM Calendar) AS Months
LEFT JOIN Metrics ON Months.Year = Metrics.NavYear AND Months.Month = Metrics.NavMonth
ORDER BY NavYear, NavMonth

Calculated member in schema workbench for Date - Year - month

Hello I am using Pentaho user console and schema workbench as a schema designer. For the dimensions of year, month and date I was using three different columns in my table up till now, But now I get to read a lot about calculatedMember in OLAP. But I am not getting how to use it for date datatype.
For an example, If I have only one column in my table which has datatype date and I want three different levels in my Cube like Year, Month and Date which can be derived by only this column. How can I achieve this??
Use calculator step of pentaho schema workbench(kettle)
by this you can differentiate the date as per your requirement.
refer this link