Calculated member in schema workbench for Date - Year - month - pentaho

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

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

Using group by with date

I have a table containing the following columns:
stats_date (YYYY-MM-DD)
registered (INT)
opened_form (INT)
Compose a query that will return the total registered, and opened_form by month for the last 3 months. Also a calculated column called conversion_rate which is the registered column divided by the opened_form.
Are you just looking for aggregation? Date/time functions differ significantly among databases, but the idea is:
select year(stats_date), month(stats_date),
sum(registered), sum(opened_form),
sum(registered) * 1.0 / sum(opened_form) as ratio
from t
group by year(stats_date), month(stats_date)
order by min(stats_date);
Of course, your database might have a different way of extracting the year and month from a date.
You can see the ANSI SQL at page 187 to understand how agregation works. To know how to group your column by Month you need to check the documentation of your db, usually is MONTH(COLUMN_NAME).

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-

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

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

How to extract dates with datatye DATETIME from colum A in table X and put them into Table Y while changing datatype into DATE

Long title, easy meaning:
How is it possible to extract from a date like "2014-04-04 10:47:30.000", which is stored in one column, it's components like year, month and day?
I'm not interested in the time.
For example, I have a table called "Incidents". Inside the table we got a column called "IncidentID" and a column called "ReportingDate", in which dates like the above-mentionend are stored. Let's say we have about 50k Incidents, therefore we have also 50k dates.
A year has 365 days. I want to query for the count of the Incidents, which were reported on different dates - for instance on the 5th of October 2013.
So: How can I get the components of the date and put them into another table while having own columns for the components and how can I query for the Incidents as well?
I guess at first I have to change the datatype of the date from DATETIME to DATE, but I'm not quite sure how to go further. May anyone help me while giving me a code and explains me what it does for a sql-noob? :-)
To achieve this
I want to query for the count of the Incidents, which were reported on
different dates - for instance on the 5th of October 2013.
you haven't do this:
I guess at first I have to change the datatype of the date from
DATETIME to DATE, but I'm not quite sure how to go further.
Just query
SELECT
IncidentID
FROM incidents
WHERE ReportingDate >= '20131005'
AND ReportingDate < '20131006'