Below query is perfectly working and bringing rolling 12 months data for selected measure. Now how do I add one more measure to same MDX query so that query fetch rolling 12 months for 2 measures?
Thanks in advance for your help.
Working query with single measure
select
non empty({lastperiods(12,[Time].[By Fiscal Year].[Period].&[Jul-21])}) on columns,
[Customer].[CustomerName].[CustomerName].MEMBERS on rows
from(
select
([CustomerNamedSet]) on columns
from [CSIS]
where ({[Time].[By Fiscal Year].[Period].&[Jul-21]},
{[Measures].[measure1]})
)
enter image description here
Modified MDX query by adding one more measure in where clause (Not working)
select
non empty({lastperiods(12,[Time].[By Fiscal Year].[Period].&[Jul-21])}) on columns,
[Customer].[CustomerName].[CustomerName].MEMBERS on rows
from(
select
([customerNamedSet]) on columns
from [CSIS]
where ({[Time].[By Fiscal Year].[Period].&[Jul-21]},
{[Measures].[measure1],[Measures].[measure2]})
)
Expected results::
enter image description here
Related
I have a cube Work with two dimensions :
Dimension Date with 3 levels : Day, month and year.
Dimension Task with 2 levels : Task A and Task B.
I want to show tasks (A and B) by year, the problem is that when I execute my query I got duplicate values of the year. I tried using distinct but it didn't work.
Here is my query :
select {[Date].[Annee].Members} ON COLUMNS, {[Task][Task1].Members, [Task].[Task2].Members} ON ROWS from [Work]
And the result I got is :
Execution result
Which is like doing : Select [Date].[1].[1].[2014], [Date].[1].[1].[2015], [Date].[1].[2].[2014], [Date].[1].[2].[2015] and so on
Query
Where the first 1 is the day and the second 1 is the month, it returns results for years of every month and day. That's why I got duplicate years but I can't find how to resolve it.
I just want the results to be more general, I want to have values of tasks done by year.
Thank you in advance!
Usually you’d have a simple year hierarchy in the cube so you could query like this:
SELECT
{[Date].[Annee].[Annee].Members} ON COLUMNS,
{[Task][Task1].Members, [Task].[Task2].Members} ON ROWS
FROM [Work]
I have written a query which is bring following data:
I want to further group it by month and year to bring total quiz and total pass for each month in the result set, I am stuck and i need help with this,
thank you
You can group by multiple columns
select QuizMont, QuizYear, .. aggregate values here
...
group by QuizMont, QuizYear
Today i have below problem while perform an sql query. Please find below data.
I perform SQL query on my table and get the below resulted output. i perform Group by on ID, Name, Week, Year, Days now i want the Days column as average of All Days based on year column. means there is multiple value of year is exist so i need Avg of Days data in all rows of DAYS for particular row. expected result as per below.
Thanks in Advance!!!
Write in comment if you have any query.
You can use OVER:
SELECT
*,
AVG(Days) OVER (PARTITION BY LEFT(Year, 4)) AvgDays
FROM
Tbl
Note: Just grouped by year (2016)
I work with Pentaho BI and I am preparing data for simple dashboard. I have records with two level date dimension (year and month). When I do query from saiku:
WITH SET [~ROWS] AS
Hierarchize({{[Date].[Year].Members}, {[Date].[Month].Members}})
SELECT
NON EMPTY {[Measures].[Count]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [data]
Pentaho create a sum for every first month, every second month... (1-12) and sum for each year. I need a sum for every year+month pair. How do I have to edit query?
Actual chart:
Target chart:
I assume you use Pentaho CDE to create a dashboard.
Set up Banded Mode property of MDX query to Classic (instead of Compact).
I am looking for a solution to convert the individual monthly averages to monthly averages from the beginning of the year. In other words from January to said month.
I used the cross tab wizard to group the rating of an employee into months in the column header. Employees are in the row header. The values of the ratings is then averaged.
My issue is this just shows the average rating of an employee for each month. I need a solution that would show me the average of each month if it included all results from the begging of the year (i.e. February would include January's and February's ratings).
TRANSFORM Avg(CSS_Table.[Emp_Rating]) AS AvgOfEmp_Rating
SELECT CSS_Table.[Emp]
FROM Rating_Table
GROUP BY Rating_Table.[Emp]
PIVOT Format([Survey_Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
One possible strategy to attack this
Create one query for each month that calculates the monthly YTD Average.
Create a Union query that joins them all together (i.e. make sure to use the same column names for each query).
Feed the union query into the Pivot.