SSAS Date Filter Issue - ssas

In my SSAS Model, I add Year Filer(2020) and YearMonth Filter(2021 Jan) same Time.
Then my measure data disappeared.
If I only add year filer then got the values.
Can't we add the year filters twice with different years

Related

SSAS/MDX : create calculated measure for specific month

I'm not friendly with MDX and I have some difficulties to create calculated measures.
We have some data in a cube and the users would like to have also the measures of the previous month, the measures of december of last year and the measures of december of the current year.
We have our own calendar table in our database with the fields date, month, year, month number...
I have created a Calendar Dimension based on this table with the Time type (with link between date -> Days, month -> Months and year -> Years ).
I have added the measure in the cube.
I try to create the calculated measure like this :
previous month :
CREATE MEMBER CURRENTCUBE.[Measures].[MEASURE_A_PREVIOUS_MONTH]
AS ([Dim_CALENDAR].[MONTH].CURRENTMEMBER.PREVMEMBER, [Measures].[MEASURE_A])
=> OK
december last year :
CREATE MEMBER CURRENTCUBE.[Measures].[MEASURE_A_DECEMBER_PREVIOUS_YEAR]
AS IIF(ISEMPTY([Measures].[MEASURE_A]), NULL, ([Dim_CALENDAR].[MONTH_NUMBER].[12], [Dim_CALENDAR].[YEAR].CURRENTMEMBER.PREVMEMBER, [Measures].[MEASURE_A]))
=> It's good for the first year (2021-M01 to 2020-M12) but after I have a sum of all the month by year
december current year
CREATE MEMBER CURRENTCUBE.[Measures].[MEASURE_A_DECEMBER_PREVIOUS_YEAR]
AS IIF(ISEMPTY([Measures].[MEASURE_A]), NULL, ([Dim_CALENDAR].[MONTH_NUMBER].[12], [Dim_CALENDAR].[YEAR].CURRENTMEMBER, [Measures].[MEASURE_A]))
=> It's good for the first year (2019-M12) but after I have a sum of all the month by year
image of cube results
It seems i can't use the PARALLELPERIOD function because I would like a specific month (december) isn't it ?
What could be the issue?
OK find the solution, it comes from my Calendar dimension, I had a bad relation, I had the relation DATE-> MONTH_NUMBER instead of MONTH -> MONTH_NUMBER. Now it's work.

SSAS, how to make Dimension Attribute Month only show the months in current year?

In our date dimension, there are Month and Year attributes. Month attribute has set int month_year as key, to avoid duplicate problem, and Month attribute has name like January, February...
Now there is problem, if user drags Year and Month to filter, and would define one year, say 2017, he expect to see Month Attribute in filter only shows 12 month names in 2017. However, Month Attributes shows month names for all years, the names repeating many times.
There is already calendar hierarchy built in this dimension. But the user wants to define filter outside of hierarchy. How to build such Month Attribute in cube? Does some one have any idea about it? Thanks in advance!
The problem has been solved. Just add a new column in date table, say Month_in_current_Year, has the same content as Month column. Add this new column to date dimension as a new attribute. This new attribute works for my purpose. It shows only 12 elements as months in one year. And it slices correct value while setting it to filter. What magic is the cube!

Pass parameter to MDX/Tabular Object Model Cube using tableau parameter/filter

I have below things:
Tableau report (with Year and Month)
The tableau report is pointing to Tabular Object Model Cube
Tabular Object Model contains date dimension, region dimension and fact sales
Trying to achieve below:
When the user selects a year and a month from the report, the report should give me sales for previous 3 quarters with reference to the month selected
If your solution proposes to use a MDX query, then it would be great if you can point to some link, to illustrate how this can be done.
I have tried below:
Dragged Year and Quarter in rows(in tableau) and dragged the calculated field in column. This gives me sales across all quarters for all years but I want to limit this information to previous 3 quarters based on the Year and month selected by the user.

Understanding the calculation in MDX

I would like to understand how the cube calculates values at different levels.
I have defined Calc as Calc = sum(Y over 12 months including current month)/sum(X over 12 months excluding current month)only for the month in the cube.
The values in month match the expected values when calculated manually. But I don't understand how the cube interprets this formula at the quarter and year level. I am not able to get the same values as in calc column when calculating manually.
Can someone explain me?Thanks.

Adding a fact table with start date and end date to a multidimensional cube

I have a fact table with payroll data and contains columns such employee id, dollars, start date & end date (pay period). So the granularity is not at the daily level. How can we add this fact table to my cube and link to date dimension? I have a date a typical date dimension in the cube with date, month, quarter and year.
note - the start and end date do not always fall on the sames days of the calendar month. I know it is terrible idea to somehow "convert" the grain to daily level by diving the dollar amounts by the number of days between start date and end date but i can't figure out another/better option.
As explained in the documentation, a relationship of a fact table/measure group to a dimension need not point to the key attribute/column of the dimension, it may point to any attribute (like the month attribute in your case). Then, you only can use the attribute that you linked to and attributes which have direct or indirect references from it. If you would have a reference from month to quarter and from quarter to year in your dimension, then the measures from your measure group referencing the month attribute can use quarter or year. But they cannot use days.