How can I add calculated measure in SSAS which shows in attached image?
Image
You can use following DAX formula in defining 'GrossValue' calculated measure as a new column,
GrossValue:=FactSellAndGrossValues[Sell]-FactSellAndGrossValues[Cost]
After evaluating that DAX expression, you will be able to see the calculated values for GrossValue as below,
Related
Looking to generate a series of dates and values on Power BI for which the first value and the increments depend on measures. (Dynamic series generation and then applying to visuals).
Tried do to this through a calculated column, however this was unsuccessful as the column is calculated before the filtering on the measure can occur - so it was providing me with undesired results.
I have also tried to use GENERATESERIES within a measure with UNION to combine the date and values series. However, I am then unable to plot this on a visual as I have multiple values for my measure.
Any help would be greatly appreciated.
Cheers
GDB007
As long as you have a fixed X-axis, you can certainly define the Y-values dynamically using measures that are dynamic.
For example:
In this example, I just defined the [StartValue] measure as a constant 1 but it could be whatever you like. The [Increment] measure here just reads in the value of a small parameter table I created to show multiple values simultaneously by dropping that column in the Legend field of the visual, but this could also be whatever you like.
I am trying to populate a bar chart in SSRS using the following calculated field:
=COUNT(IIF(Fields!JobDeployment.Value <"1440",1,Nothing))/Count(Fields!CaseStatus.Value)
To explain it is the amount of tasks that have taken under a day to complete divided by the amount of tasks.
This is then attributed as a percentage each month and the end game would be that these percentages are in a bar chart.
Now when I select my bar chart with the Values series being the above calculated field it doesn't return any values
The data is correct in the table so I'm happy with that but when I want it in graph form, I am getting no results.
Could someone please be kind enough to give some pointers as to why this is the case
Thanks
Dan
If you're using Visual Studio (as opposed to Report Builder) you should get an error message explaining why it didn't work. The expressions you can use within charts are limited. Instead, you can have the logic done at the dataset level and leave the aggregation to the chart.
Add a calculated field to your dataset to check your condition.
=IIf(Fields!JobDeployment.Value < "1440", 1, Nothing)
In the chart, just compare the counts.
=COUNT(Fields!FilteredJobDeployment.Value) / Count(Fields!CaseStatus.Value)
I have created a calculated field(Row No.), where the calculation is, Index(). Then tried to concatenate it with a field(Name) which has text data. Then I created another calculated field(Concat), where the calculation is, attr([Name])+'_'+str([Row No.]). The Concat field is showing under Measures. How can I have it as a Dimension ?
How can I create a calculated field which will make each entry in 'Name' field by adding an 'underscore' and a number to it ?
There are two possible ways to have it as a Dimension. First, the 'ATTR' is creating an aggregation, which is why it is a measure. You should be able to remove this and still concatenate with [Name]+'_'+str([Row No.]).
second, you should be able to right click on the Measure and select Convert to Discrete, then click and drag it to the Dimensions section.
You can't have a dimension based upon a call to a table calc function (such as index()), nor an aggregate function (such as sum()).
You can however convert a measure to discrete, which will allow you to use it to create headers in your view.
There is a good reason for this restriction. Dimensions are used early in the order of operations to partition data rows into blocks. They are effectively the group by clause in a SQL statement. Aggregate functions such as sum() are then applied to each partition, and table calcs are applied even later to the aggregated query results. So you can't use those results to go back in time and generate a different partition of your data rows -- which is why Tableau won't allow you to make those fields into dimensions.
Luckily, once you understand the order of operations, you can usually find other ways to get effect you need.
As a footnote, you can create a dimension based on a FIXED LOD calculated field that includes calls to an aggregate function -- such as { FIXED [Region] : CountD([Customer]) }.
I have a fairly complex calculated measure that works perfectly for each row of data from a cube. However, I then need a sum of those values line by line. But the behavior of calculated measures seems to be in the subtotal and total lines in Excel, it's performing the calculation again instead of summing the previous rows. Is there a way to have a calculated measure that performs it's calculation on each row, but they does a traditional SUM in the total and subtotals?
Thanks in advance.
A calculated measures does not aggregate; it will be computed each time.
There is a solution, but that is really ugly:
You would have to use something like
SCOPE([dim1].[hier1].[All]);
[Measures].[MyCalculatedMeasure] = Sum([dim1].[hier1].[bottomlevel].Members, [Measures].[MyCalculatedMeasure]);
END SCOPE;
for all hierarchies of all dimensions, be it an attribute or user hierarchy, replacing dim1, hier1, bottomlevel as appropriate.
You need to immitate real measure behavior for calculated member. Make dummy real measure with Null value and then use Scope to define your formula on the granullarity level. For more detailed answer see here: http://blog.crossjoin.co.uk/2013/05/29/aggregating-the-result-of-an-mdx-calculation-using-scoped-assignments/
I found the easiest way to do this:
Create a new named calculation in the appropriate measure table in your DSV. (Right click, add new named calculation and set its expression to be CAST(NULL as [insert appropriate data type]).
Add the new named calculation as a measure in your cube.
In the calculations area of your cube switch to script view and add the following:
({[Measures].[The named calculation you created in step 1]},Leaves())=Your complex calculation;
This sets the definition at the leaf level and all the aggregations work perfectly.
Ref: http://sqlblog.com/blogs/mosha/archive/2005/02/13/performance-of-aggregating-data-from-lower-levels-in-mdx.aspx
Using Pentaho Report Designer, I can successfully display my OLAP cube's data as a table.
But when I want to display the same data as a chart, it always fail saying "CHART.USER_NO_DATA_AVAILABLE".
Actually, I don't really know what I should enter for category-column and value-columns. I tried:
category-column = [Area].[prefecture]
value-columns = [[Product].[Product.Product].[All Products].[productA]]
And any other variation I could think of, but no success. Any idea? Thanks!
My OLAP cube is a Pentaho Analysis: sales count for each product and prefecture.
Just use:
[Product].[Product.Product].[All Products].[productA]
You only need the extra square brackets around the entire fieldname if it's a formula.
Or pick the field from the dropdown.. then you know you have the right one!
If you're doing a timeseries xy, note you have to repeat the category column value as many times as the value column.
also make sure you have a series name too.