I have been using
=Sum(Fields!Figure, "Dataset1")
+ Sum(Fields!Figure, "Dataset2")
Now this gives me a result in a text box.
However, i need to sum together the result from 4 different tablix datasets.
I have tried this below but as soon as i try to sum more that 2 datasets it errors.
=Sum(Fields!Figure, "Dataset1")
+ Sum(Fields!Figure, "Dataset2")
+ Sum(Fields!Figure, "Dataset3")
+ Sum(Fields!Figure, "Dataset4")
This gives me (#error). I am assuming i am missing some code somewhere but i have looked online and cant find anything anywhere.
Can anyone help?
Thanks
I'm fairly certain the field is ended with .value:
=SUM(Fields!TextBoxName.Value, "Dataset1")
+SUM(Fields!TextBoxName.Value, "Dataset2")
...
Related
I will make this question and scenario as basic as possible since I have no background on programming. How do I make a script where all red will be multiplied by 5, yellow by 6 and blue by 7? The new measure will aggregate in grand total. I don't know what expressions to use. Just use [Product] for the colors and [Measure] for qty.
enter image description here
I dont understand yet the use of MEMBERS and other expressions as this is my first time to be on it. I tried
([Measure].[Quantity],[Product].&[Yellow])*6
but it will just multiply everything with 6. Maybe FILTERS? IIF? I just don't know how. The script will go a long way when I will apply it in our database. thanks!
I know you asked about doing this with excel, but if you were writing an MDX query you could do create a new measure and run the query like this:
WITH
member measures.[ColorQuantity] AS CASE WHEN [Product].[Product].currentmember.member_key = "Yellow" THEN measures.[Quantity] * 6
WHEN [Product].[Product].currentmember.member_key = "Blue" THEN measures.[Quantity] * 5
WHEN [Product].[Product].currentmember.member_key = "Red" THEN measures.[Quantity] * 2
ELSE measures.[Quantity] END
SELECT {
measures.[Quantity], measures.[ColorQuantity]
} ON 0,
Non EMPTY
{
[Product].[Product].[All].Children /// I dont know the FULL dimension AND hierarchy path you want TO use
} ON 1
FROM YourCubeName
This might help you get started.
I have the following scenario:
I have my MDX code in a cell in a dimension.
e.g. [MDXCode].[Code].[Code] contains the string:
"([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) + ([GL Account].[GL Account Code L1].&[XYZ],[Measures].[Amount])"
Now I want this cell evaluated as MDX code.
I tried with StrToMember and ToTuple but do not get it working.
e.g.
StrToTuple([MDXCode].[Code].[Code])
However if I limit my example to ([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) it works. If I add another tuple to sum both it does not..
Try this:
StrToValue([MDXCode].[Code].CurrentMember.Name)
Edit upon further info. If you can make MDX Formula a property of Ratio Name:
StrToValue([Finance Ratio].[Ratio Name].CurrentMember.Properties("MDX Formula"))
I am trying to query a database to obtain rows that matches 4 conditions.
The code I'm using is the following:
$result = db_query("SELECT * FROM transportesgeneral WHERE CiudadOrigen LIKE '$origen%' AND DepartamentoOrigen LIKE '$origendep' AND DepartamentoDestino LIKE '$destinodep' AND CiudadDestino LIKE '$destino%'");
But it is not working; Nevertheless, when I try it using only 3 conditions; ie:
$result = db_query("SELECT * FROM transportesgeneral WHERE CiudadOrigen LIKE '$origen%' AND DepartamentoOrigen LIKE '$origendep' AND DepartamentoDestino LIKE '$destinodep'");
It does work. Any idea what I'm doing wrong? Or is it not possible at all?
Thank you so much for your clarification smozgur.
Apparently this was the problem:
I was trying to query the database by using the word that contained a tittle "Petén" so I changed the database info and replaced that word to the same one without the tittle "Peten" and it worked.
Now, im not sure why it does not accept the tittle but that was the problem.
If you have any ideas on how I can use the tittle, I would appreciate that very much.
I have two datasets in Report Builder 3.0 with a similar field and I want to put a SUM of the number occurrences of a particular value in that common field across both datasets.
I've got an expression I'm using for each individual dataset:
=SUM(IIF(Fields!caseorigin.Value = "mail",1,0))
and
=SUM(IIF(Fields!cliorigin.Value = "mail",1,0))
But I can't seem to work out a way to sum the values from both datasets. I've tried:
=SUM(IIF((Fields!caseorigin.Value, "caseDS") = "mail",1,0)) + SUM(IIF((Fields!cliorigin.Value, "cliDS") = "mail",1,0))
Is there any way to make this work, or an alternative method?
Just looks like a syntax error here; when specifying a scope it should like something like:
=Sum(Expression, Scope)
Applying this to your example:
=SUM(IIF(Fields!caseorigin.Value = "mail",1,0), "caseDS")
+ SUM(IIF(Fields!cliorigin.Value = "mail",1,0), "cliDS")
Should work for you.
I am building a report in visual Studio and have various calculations for things like total etc.
I am now trying to find the percentage of two totals but I am struggling as it won't allow me to use 2 aggregate functions in my one expression.
The functions I have are:
=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")
AND
=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")
They are the same function but act for 2 different totals so in order to find out the percentage I have to divide both these functions by each other see below:-
=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")/=Sum(Fields! Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")
can anyone suggest a better way to do this?
Many thanks,
You can use Val function
Simply try this
=Val(Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services"))/Val(Sum(Fields! Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services"))
I managed to figure it out in the end.
The way I did it was using the below code to reference the exact text boxes rather than trying to do seperate aggregate functions. This way I just had to do a divide on the two totals.
See below code:-
=(ReportItems!textbox20.Value) /
(ReportItems!textbox22.Value)
Thanks anyway for the suggestions to the original question.