Power Bi Report Builder - Calculating change from last year - reporting-services

So I have 2 datasets. One is stats for year 2022, one is stats for 2021. I want to compare the numbers (totals) for each year in each category. I did this by creating a tablix using the wizard for each dataset. The last column is a measure imported from the data set and it calculates the percentage change from the same total in the previous year. As you see everything matches except the totals highlighted in red. For example, Full-Time Domestic is 18 in 2022 which is down 66.67% from 2021's number which is 54. This is correct, however the total: 284 in 2022 is not down 74.31% from 2021; It is summing the changes. I tried removing the sum() function but it just returns the first number (-66.67%) instead of the actual change. I'm still fairly new to power bi and report builder so I'm not sure how to fix it. I've blurred some info for privacy reasons.
Screen Shot of Tablix

Related

How to display data for last few days but cumulate records from beginning of time in Tableau

I am building a Bar graph in Tableau to show daily cumulative record since January 2018. Due to number of days elapsed since then, the bars are so crunched that it looks ugly.
That said, how can I only display data for last few days while retaining the actual YTD count.
For e.g. starting January 1st I had 0 logins, February 1st - 100 YTD logins, March 1st - 200 YTD logins, April 1st - 300 YTD logins, and May 1st 400 YTD logins. I want the graph to display bars from May 1st only and show the starting count as 400 YTD logins and not zero.
PS: I am new to Tableau, so please assume that I don't know advanced stuff.
It seems that you are using Fit Width option which forces everything to be shown in your screen width. If so, try changing this to Standard, so that you may have control on the width of your bars and your users can see every month in one viz with a horizontal scrollbar.
If you do not want a scroolbar'd solution, you need to create fixed calculated fields to not get effected by the filters and use those new fields in your graph. At this point you may filter the date automatically (again with a calculated field based on the current date) or make your users manually filter what they want.
We may be in some more help if you can send a sample workbook but also you may play around with LOD expressions, FIXED keyword or simply get your calculations between { and } to fix them globally.
If you manually change the axis range, all table calculations, such as running totals, remain unaffected. You can do this by right clicking on the axis header, selecting "Edit Axis", then selecting the "Fixed" option under "Range", and choosing the dates you want to show.

Dynamically compare columns in a matrix ssrs

I've never done this for a matrix and it's going a little over my head. Trying to make a sales report, and I can do the matrix just fine. The part I'm having trouble with and I haven't been able to find a direct answer for through googling is how to get a specific value out of the matrix.
Here is a picture of it:
Report
What I need is on the far right where it says total at the top. There I need to do another break out (dynamically would be preferred but not required) the first Column would be %change of 2013 -> 2014. Then of course then next would be 2014 to 2015 and so on.
Here is the design view if it helps: Design View
So the sum total of the year compared to the year previous.
I was trying to use iif and max but I think i'm just confusing myself but the expression i have in there is:
=Sum(iif(Max(Fields!Year.Value)=Fields!Year.Value,Fields!glamt.Value,1))
Just from my testing I got no idea what values it's pulling for that.
Something I've used before is to create a variable of the SUM of previous period, in you case year. So =SUM(IIF(Fields!Year.Value = "2017",Fields!glamt.Value,0) added into the Variables section of the report.
Then in a new column within the year grouping, you add your comparison formula;
=(SUM(glamt)-Variables!sum2017.Value) / Variables!sum2017.Value * 100.00
This gives you the percentage upshift/downshift, but you get the idea if you want the actual figure of increase/decrease in sales etc.
One of the downsides of this approach is that the variables will need to be added manually and you may have a large number depending on the number of previous periods you want to compare but should suffice for say the last 5 years.

SSRS compare week to the same week number from previous year

I am working on an SSRS report that gets its data from an OLAP cube. In the OLAP cube I have a field named WeekOfYear which gives me the week number of the year based on the date. For example, week 1 for January 1st (if January 1st falls on a Monday) and week 2 for January 8th. My data is grouped by this field but now I want to be able to compare the data from this week of the year to the previous year's week of the year. Like comparing Week 1 of 2015 to Week 1 of 2014. Is there anyway that I can accomplish this? I appreciate any help. Thanks.
There is a LookUp function that should be able to do what you need.
You mention you have a WeekOfYear field. This also assumes you have a Year field (or can calculate it with **YEAR(Fields!YouDateField.Value) )
=LookUp(Fields!YourYearField.Value - 1 & "|" & Fields!WeekOfYear.Value, Fields!YourYearField.Value & "|" & Fields!WeekOfYear.Value, Fields!YourValueField.Value, "YourDataSet")
If you are actually summing multiple rows of data from your cube, you would need to use LookUpSet to get all the values and sum them with a custom function (since Microsoft couldn't possibly envision users wanting to SUM multiple records). Luckily users have already created a function - SumLookup. See How to combine aggregates within a group with aggregates across groups within SSRS if needed.
If you have access to the OLAP cube and can edit this, you could define a new Calculated Measure on the cube. How exactly this would work depends on the set up of your date hierarchies. You can also access this and define calculated measures through the Query Designer while constructing your dataset in Report Builder/Visual Studio.
Right-click in the cube browser and choose "New Calculated Member".
Reporting on weeks across years can be difficult due to the fact that the number 7 doesn't fit neatly into 365 or 366, so you always end up with a little over 52 weeks. Since the 1st of January could be a Sunday one year, and a Tuesday on the next (2012/2013), it's not always a good idea to directly compare these. So people may work around this by defining the 7-day weeks for the year against their date dimension. One year you may have 52 weeks, another you'd have 53. This is a little off topic, so I'll link to an explanation of this here, but it is important to be aware of this in order to implement my suggestion below.
Assuming you have a nice hierarchy on your date dimension that can aggregate up Weeks to Year level, you can create a new measure in your cube using the ParallelPeriod function.
[Measures].[SalesSPLY] AS
(
ParallelPeriod
(
[Dim Date].[ReportingCalendar].[ReportingYear],
1,
[Dim Date].[ReportingCalendar].CurrentMember
),
[Measures].[Sales]
)
My example MDX assumes that you already have a hierarchy called ReportingCalendar created on your date dimension. Yours may be named differently.
Now if you browse your cube and select WeekOfYear, Sales, and SalesSPLY, you will see your value for this year's week 1, alongside last year's.
OLAP cubes are very good at this type of time-based intelligence, as they can very quickly provide aggregated and offset data in a way that would be slower to run in an RDBMS or within SSRS itself.

How can I calculate YTD values in report?

My client has a standard report which shows monthly figures for various sales, enquiries etc. The report shows all months since the start of the contract (about three years ago, but growing by 1 every month!). The last row in the Tablix shows the totals (essentially the sum of all cells in that column above).
They have asked me to introduce another couple of rows, showing Year To Date values, for totals and monthly averages. I feel sure that there must be a way to do this simply (essentially it is the SUM or AVG of the last 12 rows in the Tablix), probably through grouping, but I just can't get my head around it.

SSRS Report using SSAS cube - time calculations

I am looking for optimized solution for the below problem -
I have a cube which contains Date dimension which has one hierarchy month->quarter->year.
I have created a cube, all good. Now my ssrs report requires all my dimension customer sales attributes along with the calculations like
last month profit,
current month profit,
last 6 months profit (listing every month),
last month transactions,
last year profit vs current year profit.
As i have created a hierarchy all my calucations for every month and every year and every quarter already pre-calculated in the CUBE. Now to retrieve the above listed calculations, what is the best way to do these time calculations? Where to put these calculations in CUBE or in the SSRS DATASET?
Could you please suggest some good approach and how to do it?
Although it's certainly possible - if you're comfortable with MDX - to write your query to get all these calculations into your dataset, it's usually better for reusablity across many reports to put these types of calculations in the cube. That way, other tools can also use the time calculations if you decide to use Excel or a 3rd party application.
You can use the Business Intelligence Wizard from the Calculations tab to do this - here's an article for SSAS 2005 that's still applicable to later versions: http://www.obs3.com/pdf/A%20Different%20Approach%20to%20Time%20Calculations%20in%20SSAS.pdf
And here's another approach to do something similar:
http://www.bidn.com/articles/mdx-and-dmx/169/mdx-time-calculations-done-the-right-way
UPDATE:
For named sets to handle date ranges like the last 6 months from now, see this article: http://my.opera.com/duncans/blog/using-custom-sets-in-analysis-services-to-deliver-special-date-ranges-to-end-use
not sure if I get you, but the problem is that you need to get dynamic values and you have everything hard-coded?
You can get the previous member in a hierarchy with the prevmemebr function:
([Date].[Calendar].PrevMember, <your measure here>)
where date is the dimension and calendar is the hierarchy.
So if you are browsing by month, it will get the last months data for example
You have to calculate last month profit, current month profit, last 6 months profit as measures in the cube 'calculations' using mdx query. I recently did this for my 'revenue comparison report' where I calculatedlast month's revenue, last2monthsrevenue and priorquarterrevenue and used them. It worked!