MS Access: Referring to a dynamic column name? - ms-access

Two of the columns in Query A are labeled 2012 and 2011.
However, next year, the columns will be 2013 and 2012. This is because those columns are part of a crosstab where the name is done via the year() function.
Anyway, I am using a new query to add a column that subtracts the values in the two year columns, but I don't know how to refer to those columns dynamically.
e.g. I could easily add a column
Difference: [2012 Revenue] - [2011 Revenue]
But this would stop working next year.

Why don't you label them these columns to something a little more generic and use them like this
Difference:[This Year] - [Last Year]

Building on HelloW excellent suggestion, you could use as the Column Header of your Crosstab an expression like "RevYr" & (Year(Date())-Year(RevenueDate), which would evaluate to
RevYr0, RevYr1, RevYr2, etc...
Your difference would then become
Difference: RevYr0 - RevYr1
Edit:
Facing a similar problem using a crosstab, I found these 2 very interesting links:
http://allenbrowne.com/ser-67.html
http://www.access.hookom.net/DynamicMthlyCrosstabRpt.htm

Related

SSRS: Dynamic difference between two columns in MATRIX

I try to create (in SSRS) a summary of incomes in years and I'm stuck when I try to compare them.
e.g. of my table, where Rok = Years:
I have table like at image above where A and B are Expressions (sums of incomes). Columns are years from the SQL query, So 2020 will appear soon. I would like to divide 2019 vs 2018 but dynamically so if 2020 will appear, everything will calculate between 2020 and 2019. Do you know any solution for that ? Thanks in advance :)
First you need to have an individual filtered column group for each year.
Second add in column outside group right, labelled as compare and
Insert the following expression: =ReportItems!Rok.value - ReportItems!Rok1.value ( Rok and Rok1 are the Name available from Text Box Properties for each filtered column group)

Totals in Matrix in SSRS

data in SSRS shows like this as below using the Matrix -
Can someone please help me how to get the totals for BB-1,BB-2 ,AC-1 ,AC-2 below for all the countries.I am using the running value function between the dates Aug-2015 and Jan 2017 for Columns BB-1,BB-2,AC-1,AC-2.
Type A always belong to BB-1 & BB-2. Type B belongs to AC-1,AC-2.
row groups-
Country
Type
Column Group
Date
It sounds like you want to create a secondary matrix that displays the information with a different grouping entirely. It is possible to have two matrix/tables that use the same data, and that's how I would go about solving this.
Amend the report design to the following:
Amend you report design, underneath main report add in another row group [Names], adjacent below, along with a sum(Value) field to look like this:
Report should like this:
Amend the report design to the following:

How do I create a interval of 7 days without 'w','week' or 'WeekOfYear'?

I am trying to sort data by the week it was created. I can not use 'w' in DateAdd, 'week' or 'WeekOfYear' without an error stating that function/expression is inaccessible.
What is the best way to create a substitute expression? I want the expression to group the dates based on the week it was created.
I am trying to replicate this:
http://imgur.com/Pk8YjUv
Based on the expected results you posted in the edition of your question I have reproduced the tablix.
I've used the following dataset:
I am supposing you are going to use a tablix component so I added this one with the following data arrangement.
In the Row Groups panel right click on date group.
In group properties, add a group expression and set this:
=DATEADD("d",7-DATEPART(DateInterval.Weekday,Fields!date.Value),Fields!date.Value)
Also in the tablix you have to set the same expression:
In the columns you want to sum you can use the Sum function or any aggregation function. I've used =Sum(Fields!value.Value) to Sum values within the same week.
This is the result it will preview:
Let me know if this was helpful.

how use average function based in two differents dataset fields ssrs if one depend from the other one

im working with report that visual studio 2010 have, then i have a chart series with four fields planta, date, and densidad, i have to get the average of all the data that densidad has but only when the date is the same for example
Date Densidad
11/05/2015 2
11/05/2015 3
12/05/2015 4
in this case i have two data from 11/05/2015 the only for that date i must get the average that in this case should be 2,5 , ive been looking for an expression that works but i ve found anything, please?
Add a new row group, then go to the group's properties and group by date. In your tablix, add in AVG(Yourdataset!Yourvalue.Value) next to the date. This should group by date.
Your group expression should look like this:
=FormatDateTime(Fields!dates.Value, DateFormat.ShortDate)

Dynamically Add\Remove columns SSRS 2012

I have SSRS report that has around 80+ columns. I have requirement where in dynamically hide\show columns in report based on user selection. I could able to do it by setting expression for "Visiblity" property and having report parameter thro' which columns to display can be choosen.
My problem is 2 points
fox example if columns 2 and 4 to be hidden, then there is an empty column between 1 and 3 and 5 columns. How to avoid this
When i export to PDF / Excel these spaces prevail.
Let me know your suggestions / help.
You can create a query that pivots your data, so that instead of a return table like this:
ColumnName0, ColumnName1, ColumnName2
Value[0][0], Value[0][1], Value[0][2]
Value[1][0], Value[1][1], Value[1][2]
You could format it like this
ColumnName, Value0, Value2
ColumnName0, Value[0][0], Value[1][0]
ColumnName1, Value[0][1], Value[1][1]
ColumnName2, Value[0][2], Value[1][2]
And then your first column (ColumnName) would always be your title, and you could use it as your column group. You might have to use a dynamic query for this, but it would take care of both items 1 and 2 in your question.
Actually I solved my issue with following URL
http://bhushan.extreme-advice.com/conditionally-setting-column-visibility-in-ssrs/