SSRS text and calculation - reportingservices-2005

In SSRS in one of my tables cells I have the following calculation:
=((SUM(Fields!Shipment_Weight.Value)) / 2000)
Is there anyway to then add a T to the value that this returns denoteing that it is Tons?

=CStr(((SUM(Fields!Shipment_Weight.Value)) / 2000)) + "T"

Related

Conditional formatting in matrix cells

I have the following matrix loaded:
I need to change the font color of the BB column values ​​when the value is below the value contained in the MIN column cell.
Being grouped columns, the MIN column will not always be in fourth place. How can I do to compare values ​​taking into account the name of the columns?
Thank you!!
I share the output of the dataset:
I have found a solution based on our discussion in the comments:
Create a calculated field in your dataset Ref = ELEMENT + COMPONENT (concatenate the 2 colums, this will be used later)
In the Row Group properties, add a variable MinVar =lookup("MIN" & Fields!Component.Value ,Fields!Ref.Value,Fields!Value.Value,"DataSet1") (replace DataSet1 with your dataset name)
In the font expression of the value field add an expression =if(Fields!Element.Value ="BB",if(Me.Value< Variables!MinVar.value,"Red","Black") ,"Black")
I have tested this and it is working on my end.

Adding different row values for Birt

I got this selection of data from my sql:
I would like to add Cancelled, Disputed and Resolved together and then divide the result with the total shipped. All of this should be done with an Expression.
So x / 303 where x is the sum of the desired values.
Goal would be to get a % where I can tell how good my shipping is.
I would then like to display the result in a text label next to a graph.
How do I do that?
You should use computed columns in your data set:
Add a SUM on the column Total and a filter only matching the rows based on the column Status you want to select. The expression should look like:
if (row["Status"] == "Cancelled" || row["Status"] == "Disputed"
|| row["Status"] == "Resolved")
true
else
false
create a second computed column only containing the "Total" value where the Status is Shipped.
if (row["Status"] == "Shipped")
row["Total"]
Then create a third computed column where you divide both computed values and you are done.
row["sum"] / row["shipped"]
create a new parameter and refer the image
create new static values and allow multiple values to be selected.
So, accordingly edit your SQL queries

How to make a random sampling of 20% of records in Tableau?

In Tableau 9.2, is it possible to generate a random sample of records? If so, how could I do this? Say I have a field called Field1, then I intend to only select 20% of the records. So far, I have found how to a generate random integer in Tableau, though it is bewildering that Tableau does not already have a function for this:
Random Seed
(DATEPART('second', NOW()) + 1) * (DATEPART('minute', NOW()) + 1) * (DATEPART('hour', NOW()) + 1) * (DATEPART('day', NOW()) + 1)
Random Number
((PREVIOUS_VALUE(MIN([Seed])) * 1140671485 + 12820163) % (2^24))
Random Int
INT([Random Number] / (2^24) * [Random Upper Limit]) + 1
So how could I create a calculated field to only show random records that make up 20% of Field1?
When you make an extract, there is a dialog panel where you can filter records and specify rolling up to visible dimensions.
For at least some data sources, you can also specify a limit of the number of records (say grab the first 2000 records) or a random percentage (say, 10% of the records)
Then you can work with the small extract quickly to design you viz, and then remove the extract or refresh with all the data when you are ready. I don't think every data source supports the random selection though.
There is a random number function ins Tableau, but it is hidden and doesn't appear on the list of available functions.
It is "random()". It generates a uniformly distributed number between 0 and 1.
It isn't documented but it works. See, for example, this previous answer: how to generate pseudo random numbers and row-count in Tableau
I ended up solving my issue through the back-end in my MS Access database with the following MS Access SQL Query within a MS Access VBA macro I made:
value1 = "some_value"
fieldName = "[my_field_name]"
sqlQuery = "SELECT [my_table].* " & _
" INTO new_table_name" & _
" FROM [my_table] " & _
" WHERE [some_field] = '" & value1 & "'" & _
" ORDER BY Rnd(-(100000*" & fieldName & ")*Time())"
Debug.Print sqlQuery
CurrentDb.Execute sqlQuery
I ended up deciding that something like this would be best left to the back-end and to leave the visual analytics to Tableau.

custom expression to subtract from and then multiply the sum of a column in spotfire

What would the custom expression for: 2*(Max[X] - 0.5) for every group be, in Spotfire?
Do I need to split this into multiple steps or can create a custom expression that would do it all at once for every group of data I have.
I figured it out. I did it in two steps:
1. Created a calculated column Max_X = Max([X]) OVER [GROUP]
2. Created a calculated column D = 2*([Max_X] -0.5)

Cognos 10 Filtering a calculated measure

Using a Crosstab dimensional report I having issues filtering out a specific value that I am getting from my calculated measure:
I am using the following calculated measure in Reporting Studio to get the required output..
ROUND(([A1_SCHEDQTY]+[B1_SCHEDQTY]) / ([A1_QTY]+[B1_QTY]) * 100, 1)
However, in a few cases I am getting an output of '/0' I am unable to filter this out. I have tried using an IF statement, but I believe my syntax is incorrect.
IF (ROUND(([A1_SCHEDQTY]+[B1_SCHEDQTY]) / ([A1_QTY]+[B1_QTY]) * 100, 1) = '/0') THEN NULL ELSE ROUND(([A1_SCHEDQTY]+[B1_SCHEDQTY]) / ([A1_QTY]+[B1_QTY]) * 100, 1)
Any advice?
You need to check the divisor of the equation for 0 instead of checking the entire equation for '/0'. If you check the entire equation, the divide by 0 still takes place.
Try this:
IF ([A1_QTY]+[B1_QTY] = 0) THEN (NULL) ELSE (ROUND(([A1_SCHEDQTY]+[B1_SCHEDQTY]) / ([A1_QTY]+[B1_QTY]) * 100, 1))

Resources