I have a dimension with the following levels:
Years
Months
Days
I want to get some data by months regardless of the year, i.e. weddings in January.
If I have:
January 2011 - 43
January 2012 - 20
January 2013 - 30
What I want is:
January - 93
Is it possible?
Thanks
Edit:
I have tried this query (with sales, no weddings):
WITH member [Time].[example] AS 'AGGREGATE({[Time].[Months].[Jan]})'
SELECT
NON EMPTY {Hierarchize({[Measures].[Sales]})} ON COLUMNS,
NON EMPTY {[Time].[example]} ON ROWS
FROM [SteelWheelsSales]
but I only get the first January.
Yes, this depends on how you structured your calendar dimension. In this case, you would have a month string field, and it would have
January
February
... So on... Note that the month string field, does not have the year included.
This field would be aggregatable set in the SSAS dimension. When creating your MDX query you would put month on rows, and weddings on columns. Using this approach you should get your desired result.
So doing the following should get you all January sales :
SELECT
NON EMPTY {[Measures].[Sales]} ON COLUMNS,
NON EMPTY {[Time].[Year] * [Time].[Jan]} ON ROWS
FROM [SteelWheelsSales]
Related
Right now the problem with my code is that it counts each month as a new aggregation, meaning that January and February will contain activity for the same account in both months. I only need the monthly activity for each month at the level of each account.
Right now where for example the activity for Account A = 100 for January and activity for Account A = 25 in February, my query shows activity in February for account A as 125 when I would like it to be returned as A = 100 for January and A = 25 for February.
Is this clear? If I use for example (YEAR(date_column)) the aggregation at the annual level is accurately represented. This approach however does not allow me to provide a monthly breakdown of the data. If I add a second column to get the "Month" values from the date e.g: (MONTH(date_column)), the numbers are aggregated month over month and not at the month level alone.
I would like to create DAX expression. This is the condition and I have my month and year table in separate column.
If we choose Month as a March then it should show the sum of amount of Jan, Feb and as well as March. Similarly, If we choose Month as Dec then it should have the sum from Jan to Dec.
How can we write DAX expression for this condition in Power Bi?
You probably need a measure as below. You need to have a separate Date/Calendar table for that which is connected to your Data table using Date column.
total_amount_ytd =
CALCULATE(
SUM(your_table_name[your_amount_column_name]),
DATESYTD(your_date_table_name[your_date_column_name])
)
With this above Measure, if you add Year/Month in a table with the new Measure, you will find the value per year will increase from January to December for a single year and starts re calculating from January again in the next year.
My report displays price_totals per month with each month populating the row header:
As you can see, the months aren't in order (and they dont necessarily need to be. This is designed to be ran for our fiscal year). Notice that after May, it skips to October. October - December are months in 2015, and then the 2016 months are ran from Jan - May.
To "fix" this, I simply added a 'Year' row above the row of months:
Im not a huge fan of how this looks. Can I group the 2015 months together, and the 2016 months together to only display each year once instead of showing the year for each month?
Here is my tablix design in case you were curious:
Using SSRS, you can sort by fields that are not displayed. On your column group that generates the months column, set the sort by to the following:
=Fields!Year.Value & "-" & RIGHT("0" & Fields!Month_Number.Value,2)
Note that this function will generate a year-month string that will look as follows and will facilitate proper sorting.
2015-01
2015-02
2015-03
2015-04
2015-05
2015-06
2015-07
2015-08
2015-09
2015-10
2015-11
2015-12
=Switch(Fields!NameOfMonth.Value="January",1,Fields!NameOfMonth.Value="February",2,Fields!NameOfMonth.Value="March",3,Fields!NameOfMonth.Value="April",4,Fields!NameOfMonth.Value="May",5,Fields!NameOfMonth.Value="June",6,Fields!NameOfMonth.Value="July",7,Fields!NameOfMonth.Value="August",8,Fields!NameOfMonth.Value="September",9,Fields!NameOfMonth.Value="October",10,Fields!NameOfMonth.Value="November",11,Fields!NameOfMonth.Value="December",12)
you can do datepart and sort by using above expression
Month Sorting
I have a table with more than 20000 rows, In one of column i have month from jan 2014 to Dec 2014, and in another column i have a loan number. Most of the loan Numbers are reapeting every months,now i need to get only the loan Number which are apperead in all three monthy consecutively. For eg if i am getting data for current months i also wanted get data which are common in two months before the current months. The database that i m using is Access DB. Any adivice will be more than a help, Thanks in Advance.
SELECT Loans.LoanID, Sum(IIf([period]=[month],1,0)) AS CM, Sum(IIf([period]=[month]-1,1,0)) AS [m-1], Sum(IIf([period]=[month]-2,1,0)) AS [m-2]
FROM Loans
GROUP BY Loans.LoanID
HAVING (((Sum(IIf([period]=[month],1,0)))>1) AND ((Sum(IIf([period]=[month]-1,1,0)))>1) AND ((Sum(IIf([period]=[month]-2,1,0)))>1));
I used month as an integer, and didn't make any adjustment for months 1 and 2 to loop back and look at prior year - you should be able to modify this based on the actual format you are using for the month.
I am novice with SSRS.
I have a report which should display 60 months (5 years displayed like Jan 1999, feb 1999 & so on till the end of 60 months) and its corresponding sales amount. I want to get averages for the first 12 months (i.e for the 1st year) and so on. Is it possible? My dataset just gives me all the 60 months row-by-row.I am using matrix for my report.
Thanks,
User007.
I would add some nested row grouping to the matrix. The higher-level group would be by year, which would allow you to have a row in the matrix that totals/averages all of the data for the year. The inner group would be by month, giving you the individual month rows as your dataset returns them.
Here is some information about defining and using groups