ssrs using two lookup with replace - reporting-services

I have two datasets and I want to look for a value in each dataset with Lookup. For example if we have dataset1:
SELECT Persons.clname, Persons.Sex, Persons.clcode, Persons.Memid
And dataset2:
SELECT Persons.clname, Persons.Sex, Persons.clcode
How can we mix two lookups in a single expression:
Lookup(Fields!memid.Value, Fields!memid.Value, Fields!sex.Value, "dataset1")
Lookup(Fields!clcode.Value, Fields!clcode.Value, Fields!sex.Value, "dataset2")
And finally, if we have "M" replace it with "Male" and, if we have "F" replace it with "Female"?

Related

Google Sheet Query and ImportHTML Function show numerical values as text

I'm importing some data using the formula below but the numerical values appear as =1599 (for example) and are being treated as text (ie cannot use them in a formula).Does anyone know how to substitute the "=" to "" in the table? The numerical values are in column H.
={QUERY(IMPORTHTML("https://1234567.website.com","table",0), "where Col1 is not null",1)}
I tried wrapping in:
SUBSTITUTE( ... ,"=","")
ARRAYFORMULA(SUBSTITUTE( ... , "=","")
TO_PURE_NUMBER(
Nothing works. Is there a way to apply one of these solutions only to the columns with numerical values?
Try iferror() and regexextract(), like this:
=arrayformula(
lambda(
data,
iferror(value(regexextract(data, "[-.\d%]+")), data)
)(
importhtml("https://1234567.website.com", "table", 0)
)
)

SSRS REPORT BUILDER, Comparing two diffrent data sets in one Tablix, Expression

I have two datasets and want to compare them in an expression.
I would like to do something like this:
=iif(Fields!Grade.Value = "ONGRADE" > LookupSet(Fields!Grade.Value = "ONGRADE", Fields!grade.Value = "ONGRADE" , Fields!grade.Value = "ONGRADE", "Previous3Week"), "UP" ,"DOWN")
This currently returns "Error" within the "ONGRADE" row.
you need to bind your component with one of the datasets and then accordingly you can write following expression :
=iif(Fields!grade.Value > (Fields!grade.Value, "ONGRADE_DataSet2") , "UP", "DOWN")
in this example, the component is binded with the first dataset and the second dataset is getting referred.
This may help.

SSRS Filter by parameter and Value condition

I am trying to add an parameter that will allow the user to filter by unit Cost. I.e. If for parameter Unit cost, User select "All Costs", it will not perform any filter and will show all items. However, if for the parameter Unit cost, the user selects "Greater than 0" it would only display items that have unit cost > 0.
I have declared the parameter with two available values "U" and A".
However, what would the Parameter condition look like? I tried adding the condition which was =IIF(Parameter!Text.Value = "U", UnitCost, NOTHING) > 0.
This doesn't seem to be working though. Can anyone provide suggestions as to how this would be done.
You can use an expression to determine if a row should be filtered or not based on the parameter selected value.
Add a new Filter condition in your tablix and use these settings and expressions:
In Expression textbox use:
=Switch(
Parameters!Text.Value = "All", "Include",
Parameters!Text.Value = "U" AND Fields!UnitCost.Value > 0, "Include",
Parameters!Text.Value = "A" AND Fields!UnitCost.Value > 10, "Include",
true, "Exclude"
)
In the Value textbox use:
="Include"
Note your parameter should have an available value as conditions to filter you need.
In this case I use A parameter value to filter the UnitCost values greater than 10 and U value to filter UnitCost values greater than 0. Customize to meet your requeriment.
Let me know if this helps.

SSRS - How to filtered dimension subcategories into a single group

I'm not sure if this is possible but I'd like to be able to return a set of figures bases on a set of subcategory dimensions.
To explain visually I'm using this MDX for my data:
SELECT NON EMPTY
{[Measures].[Freight]} ON COLUMNS
,NON EMPTY
{
[Product].[Category Name].&[Accessories]*
[Product].[Product Subcategory Key].[Product Subcategory Key].MEMBERS*
[Due Date].[Calendar Month].[Calendar Month].MEMBERS
} ON ROWS
FROM [Adventure Works Cube];
In my report I set out my table like this:
And for the product subcategory key I'm applying a filter like:
So the preview of the report looks like:
What I'd like to see the freight for accessories (20-29) in one line. Even if I take out the product subcategory key from the table but leave the grouping in I still get 4 lines rather than one.
Is it possible to have Accessories (20-29) display in one line? I realise I could filer my dataset but I'd like to use this one to be able to then create another tables and show the Accessories (30-39). Rather than have 6 dataset, one would be better and just filtering it would be great.
you could create the group manually and then use it instead of product subcategory key.
In dataset properties >> fields tab >> add calculated field >> like:
=SWITCH(Fields!subcategory_key.Value = "26", "G1",
Fields!subcategory_key.Value = "27", "G1",
Fields!subcategory_key.Value = "28", "G1",
Fields!subcategory_key.Value = "29", "G1",
TRUE,Fields!subcategory_key.Value
)

Hide row based on a value from another dataset

I have a tablix that has one dataset, and I need to hide one row based on a value in another dataset.
Currently I have this expression under visibility:
=Iif(Fields!Data1.Value="0" or Fields!Data2.Value="1", TRUE, FALSE)
Both of these are in another dataset called vDataset3.
Use this code
=IIF(First(Fields!UserID.Value, "DataSet2") = 0 or
First(Fields!UserID.Value, "DataSet2") = 12, True, False)
In order to call a field in another dataset you need to write:
First(Fields!UserID.Value, "DataSet2")
The first means that you take the first row. you have to do that because a dataset is like an array you must declare the field you would like to get.
and the "DataSet2" is the name of the dataset