How to make a column invisible in an ssrs matrix - sql

I have an ssrs matrix , the design of which looks like this :
The sql query used in the above dataset looks like this :
select [YEAR], [MONTH] as MONT , ProductName, NumberofSales from XYZ ;
When the report is run , My output looks like this :
Here , the Column Names 9 , 10 correspond to the months 9 - September and 10 - October.
Change shows the difference in numbers between the month and the previous month . example :
number of sales in october - number of sales in september.
I would like to remove the column that I have circled in the above picture . Could you please let me know how I can do this . ??
I already tried right clicking the Change column and changing the visibility property, by adding an expression to look soomething like this :
=(Parameters!UserSelectedDate.Value=Fields!MONT.Value)
But that gives me an entire blank space for the Change column like this :
But I do, not want to see the blank space. I would like to remove the column completely.
Please let me know if it is possible.

I don't know, why it shows blank space, but here is how I handled this problem:
Choose "column visibility" property of column "Change"
Then I added expression for hiding column: =IIF(Month(Fields!Date.Value)=Parameters!UserSelectedDate.Value,True,False)
And when I select report parameter to 1 and preview the report, it hides Change column for month 1:

This answer works only for matrixed (varied count) columns.
But in all reports client want to group report data dynamicly and select column that one want to see.
So if I have matrix for example with columns -
[Store] [Good] [Amount Jan] [Amount Feb].... [Amount Dec]
I can hide any column with Amount but If I right click on column Store - No option in menu- Column properties and option Column Visibility - Disabled. If apply visibility to cells - you'll see a blank space.

I've looked for an answer for this issue and was frustrated that I could not find any. Then I found a workaround for this issue, I decided to share this.
You have to create column groups for all columns, which you would like to Show/Hide. For this matter you have to take or create one or more attributes in you ResultSet, which contain a constant value, so that the columns will not be later propagated.
After you created a new Column Group (as Adjacent Before/After)
you can put there the columns, which you like to Hide/Show.
After that you can use the property "Column visibility". It works just fine for me.

Related

Qlikview conditionally hide expression in pivot table

Struggling with a way to hide an expression on certain rows in my pivot table below. Basically, I want to be able to hide my expression 'Cumulative' when the FINANCIAL_PLAN_TYPE is not equal to 'OB_VARIANCE_TO_T1'. I figured out a way to change the text format on the lines with other FINANCIAL_PLAN_TYPE so that it appears hidden (what is showing in the picture below), but I'd really like the whole row to go away in these cases.
Additionally, I do not want to see a Total on the Cumulative lines if possible, but I do want to keep them on the Sum(AMOUNT) lines.
My expression for Cumulative is:
sum(aggr(Rangesum(above(sum({<YEAR={"$(vYear_Current)"},FINANCIAL_PLAN_TYPE={"OB_VARIANCE_TO_T1"}>}AMOUNT),0,MONTH_NUM)), FINANCIAL_PLAN_TYPE, MONTH_NUM))
I tried to use the function Only, as well as, I tried conditionally enabling/disabling the expression but I can't seem to get it to work. Any ideas would be great. Thanks!
FINAL SOLUTION:
1) Load Inline Table
Load * Inline
[MyDim
Cumulative
Vals
];
2) Created calculated dimension to combine the two desired dimensions into one and show blank ('') in cases that you don't want to show (this leaves one blank line on the pivot but there is probably a way to hide that too):
=If(MYDim='Cumulative' and FINANCIAL_PLAN_TYPE='OB_VARIANCE_TO_T1','Orig Budg Cumulative Variance',if(MYDim='Cumulative' and FINANCIAL_PLAN_TYPE='LE_VARIANCE_TO_T1','LE Cumulative Variance',if(MYDim <> 'Cumulative',FINANCIAL_PLAN_TYPE,'')))
3) Create a new expression that does one calculation in the case of your made up dimension = Value A and something else in case your calculated dimension = Value B
If(MYDim='Cumulative' and (FINANCIAL_PLAN_TYPE='OB_VARIANCE_TO_T1' OR FINANCIAL_PLAN_TYPE='LE_VARIANCE_TO_T1'),If(ColumnNo()=0,'',sum(aggr(Rangesum(above(sum({<YEAR={"$(vYear_Current)"}, DEPARTMENT={"20820"}, ACCT_TYPE={"Capital"}>}AMOUNT),0,MONTH_NUM)),
FINANCIAL_PLAN_TYPE, MONTH_NUM))),IF(MYDim='Vals', SUM({<ACCT_TYPE={"Capital"},DEPARTMENT={"20820"}>}AMOUNT)))
You cannot hide expression on some of the rows - not possible in Qlikview.
The workaround is to create a dummy floating table that holds the second column as a dimension and then use it in your chart instead of the two expressions. Then you will have one expression that says something like that :
If ( dummyField = 'Cummulative' and = 'OB_VARIANCE_TO_T1',
{Use your second expression here} ,
If (dummyField = 'sum(Amount)', {use your original first expression here}))
Regarding the Total, check out this link in the "Tricking the Pivot Table" section

SSRS how to use multiple criteria in expression - based on a row value and a field name

Please look at the image below, my dataset has two processes, 'logs processed' and 'stacked at kilns'.
I need to take the total 'stacked at kilns' and divide it by the total 'logs processed' for each length.
so for example for field name 5.4 (dataset field length), I would like to divide 2784/2283 to return a percentage of the recovery.
my expressions currently is
=Sum(IIf(
(Fields!process.Value = "Logs Processed") AND (Fields!Length.Value=Fields!Length.Value)
, Fields!cubes.Value
, Nothing)
, "Wetmill_to_Kiln")
But this returns the value of all lengths where process is 'Logs Processed' not for just length 5.4 as per example.
So each length field is dynamically created (3.3,3.6,3.9 .... 6,6.3,6.6)
I would like to get the total for 'stacked at kiln'/'logs processed' for each length field.
any help appreciated as always
example of my desired output in bottom image.
current output:
Desired output:
*****UPDATE AS PER TPHE*********
I have created a text box inside the column group. this returns the value for that group but how can I reference the value of that text box.
if I use something like ReportItems!tbxSource.Value how can I reference the value of the textbox when the it is dynamically created across the column group? there are then mulitple instances of that textbox name?
with reference to the picture how do get the value of the white <> from the textbox with green <>
Thanks,
Since you are using a column group, you can put your expression into a text box within the group and it will execute on only the data that is captured within each column. So if your code for the Logs processed row is something like Sum(Logs) and your code for the Stacked at Kiln row is something like Sum(Stacked), your expression code for the recovery row would be Sum(Stacked)/Sum(Logs). The key is to make sure that it is within the column group.
So what I got to work was to create two variables on the column group. one called kilntotal and one called logtotal. the variables value was equal to the result of this expression:
=sum(iif(Fields!process.Value="logs",cdbl(Fields!cubes.Value),cdbl(`0)))`
and
=sum(iif(Fields!process.Value="kiln",cdbl(Fields!cubes.Value),cdbl(0)))
I then use these variable in my logic in my recovery % row:
=Variables!kilntotal.Value/Variables!logtotal.Value
Thanks for the input and your time.

Counting text-items per page in MS access

I'd like to count a text-string in every page on a report and print out the count of the strings in the page-footer.
Searching for a string in a text field is straight forward, counting the findings within the text-field too, but how is it possible to sum the findings in a integer variable per report-page when it has several entries?
i.e. I´ve got a report-page like this where each new line is a new record.
Here the first report-page:
aaaaaaF
aaaaaFF
ffaaaaaaaaa
FaaaaaFF
Now the page-footer:
There are 4 records. The letter "F" has been found 6 times on this report page.
Now the second report-page:
aaaFaaF
aaaaaF
fFaaaaaaaaa
FaaaFaFF
FFaaaaFa
page-footer:
There are 5 records. The letter "F" has been found 10 times on this report page.
I'd be happy if smdy has an advice for me.
Thanks!
First step is to figure out how many occurances of "f" occur in each record. Which you can do using
= Len([myField]) - Len(Replace([myField],"f",""))
Now for the total occurances in that page you use the Sum function in a text box in the report footer section.
= Sum( ... )
= Sum(Len([myField]) - Len(Replace([myField],"f",""))) ' if report based on a table
= Sum([myCalculatedField]) ' if you use the occurance count formula in the query instead
If you need to total across the page there is a link detailing how to go about it here (you'll have to scroll down a bit)
http://office.microsoft.com/en-us/access-help/summing-in-reports-HA001122444.aspx
You haven't shown any of the expressions that you are using but, essentially, in the Report Footer you would include a textbox which uses your aggregate function:
=COUNT([SomeField]) 'or
=SUM(iif(some condition, 1, 0))
where SomeField is a field in the detail section, or some condition refers to this field.
That is, you need to SUM (or COUNT) across the whole report by referring to field(s) in the details section. You do not do this by attempting to refer to the subtotals that you have in the page-footers - this won't work.

SQL Reporting Services - Subreports Broken into multiple columns

I inherited an SQL Reporting Services .rdl project from somebody and need help fixing some functionality.
In each row of the report, there is a subreport. In order to save space the subreport is divided into 3. Such that in each row of the report, it splits the data of the subreport into 3 smaller tables. Right now, it fills these 3 subreports horizontally. (ie. if the result has 9 values, the first subtable will have 1, 4 & 7, the second subtable will have 2, 5 & 8, etc)
Is there a way to have it fill the subtables vertically? (ie. the first subtable would have 1,2 & 3)
Thanks!
By default, the multi-column reports should fill vertically. In fact, there isnt even an option to fill horizontally so i'd like to know how it is being done. Perhaps the underlying query has been modified?
In fact, I took a deeper look into the query and it turns out that the column number is being passed as a report parameter and the results are being reordered using a modulo on the column number. I don't have it with me right now, so I don't have the exact syntax.
More info for anyone trying to do this:
it turns out that the subreport query gerates a column which indicates the row number
ROW_NUMBER() OVER (PARTITION BY columnName ORDER BY otherColumn) AS RowNumber
Then in the report, the subreport is included 3 times. Each subreport has a report parameter called Column, the first one is of value 1, the second 2 and the last one 0. The subreport then has a filter on it
=RowNumber Mod 3 = Column
that way the subreport results are divided into 3 supreports that can all be placed on the same row to save space.

How to make a drop down list (list box)in an MS Acess Query with values from two different tables

I need the drop down box above to display the date as shown and the ClassTypeDesc as you can see above the dropdown list shows 1/12/2010 twice. They have different ClassTypes Assigned to them.
The drop down list should show:
1/12/2010 ACLS-I Day One AM
1/12/2010 ACLS-I Day One PM
I need to know the statement to put in the Row Source Box on the lookup tab in the Field Properties to make this work.
Related Question on Making a drop down list
There's no need to concatenate the two columns. Based on the diagram, the SQL for your lookup combo box should look like this:
SELECT tblClassSession.SessionID, tblClassSession.Date, tblSessionType.ClassTypeDesc
FROM tblClassSession INNER JOIN tblSessionType
ON tblClassSession.SessionTypeID = tblSessionType.SessionTypeID;
Then in the properties for your lookup combo box, change ColumnCount to 3, and Column Widths to 0 (if you want to size the other columns, change Column Width sto something like 0";.75";1.5", and the List Width property to 2.25").
I may have gotten some of the field names wrong, but that's the basic idea.
(also, you probably really ought to rename tblClassSession.Date to tblClassSession.SessionDate so you don't run into problems with the fact that Date is a reserved word)
As you already have the right number of rows, you just need to concatenate enough fields to make it more useful, so your query would be something like:
SELECT c.Date + ' ' + s.ClassTypeDesc AS YourFieldName
FROM...