Calculating columns in Crosstabs - CRIX
Post Author: Jimi H
CA Forum: General
Please help!!! I cannot seem to find an answer to this one even though the question has been posted before.
I have two columns in a cross-tab and need to divide one by the other. I have created a formula to do this (my 3rd column) but CR9 calculates the total of column 1 not the individual row.
i.e. Data is grouped by Date.
Column 1 is no. of loads.
Column 2 isJob Price.
Column 3 needs to be £/load.
When creating the formula to do Job Price/no. of loads instead of dividing by the no. of loadds for that particular date CR takes the total from the bottom of the cross tab and uses that figure instead. Does anyone know how to get round this so that the correct figures are used. Thanks
Post Author: Jimi H
CA Forum: General
Hi thanks for the reply. The header says CRIX though!?!
Anyways, this is the same procedure I have followed in CR9, formula @£/load is {@Job Price} / {@Load Count} but instead of using the summarised Load Count figure for that particular date(this needs to be a distinct count of job booking numbers, hence the formula), CR still uses the Grand Total figure.
i.e Job Price = £200, No. of loads = 10 for 01/11/07. £/Load should be £20. But the grand total for No. of loads for all of November is 907. CR is doing the sum 200/907=£0.22.
Any ideas?
Similar Messages
-
Inserting a calculated column after every column in cross tab, in crystal report 2011
HI,
I want to insert a calculated column after every column i a cross tab . The cross tab shows , sales by region for a number of years , for example from 2007 to 2013. The year can be changed based on the user parameter. How can I do that ?
ThanksHi Feroz,
To calculate the Percentage Change and also to show the Percentage sign, here's what you need to do:
1) Right-click the Calculated Column Header > Calculated Member > Edit ColumnValue Formula and use this code:
cdate(1890,01,01)
If the field used as the column is a datetime field, use this:
cdatetime(1890,01,01,0,0,0)
2) Right-click one of the zero values in the Percentage Column and select Calculated Member > Edit Calculation formula and use this code:
if CurrentColumnIndex = 2 then
If GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex) = 0 then
0
else
(GridValueAt(CurrentRowIndex, CurrentColumnIndex-1, CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex))/
GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex)
) * 100
else
If GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex) = 0 then
0
else
(GridValueAt(CurrentRowIndex, CurrentColumnIndex-1, CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex))/
GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex)
) * 100
3) Right-click one of the Values in the summary cells > Format Field > Number tab > Customize > Currency Symbol tab > Click the formula button beside 'Currency Symbol' and use this code:
If Year(GridRowColumnValue("Date_field")) = 1890 then
"%" else "$"
Note: Replace Date_field with the field name you've used as the Column in the Crosstab. The double-quotes ARE required and you should remove any curly braces that CR adds automatically.
4) You might want to use a similar code in the 'Position' formula too.
Let me know how this goes.
-Abhilash -
Discoverer Row wise calculation columns
Can You use Excel type Formulations in discoverer?
Meaning Can a calculation column that calls the row into a formula such as a general
i.e. Apples, bananas, oranges ROWS Calculation Column ROW / Total fruit
That include crosstabs such as time and let's say grocery store
Also there is a requirement that states if percent of apple fruit is greater then 50% of total fruit then a string such as "more then half" must be displayed in a calculation column....
The actual formulas are more complicated however these examples are to find out discoverer functionality.
Thanks way in advance....Can You use Excel type Formulations in discoverer?
Meaning Can a calculation column that calls the row into a formula such as a general
i.e. Apples, bananas, oranges ROWS Calculation Column ROW / Total fruit
That include crosstabs such as time and let's say grocery store
Also there is a requirement that states if percent of apple fruit is greater then 50% of total fruit then a string such as "more then half" must be displayed in a calculation column....
The actual formulas are more complicated however these examples are to find out discoverer functionality.
Thanks way in advance.... -
Problem with binding value on the UI from a calculated column in the view
I have calculated field "Readiness" in my db view, which gets calculated based on other columns in the same table. I have added new column to my EO using "Add from table" option and added the same column from to VO using "Add from EO" option. In my application, I will update a particular date field in the UI and this calculated column "Readiness" in the db will be set to yes or no and this logic is working fine, both date date field and calculated field are in same view object. I have added a attribute binding to this "Readiness" column in my view page. The problem is the calculated column value does not reflect the new value in the db, it shows the old value. I have tried different refresh option for the iterator and ppr option for the field binding. Even after reloading the page, the value shown on the UI page is different from the value in db, other bindings on the UI page works fine, not sure any special settings are required for the Calculated columns. any ideas are appreciated.
Thanks for your help,
SuryaI tried to add soms debugging statements in the EO and getters method, the calcaulated column is not picking the value in db view. I'm not any special iterator/field settings are required at BC level. I'm a newbie, any help is appreciated.
Thanks,
Surya -
I am trying to learn HANA on my own.i have product id,product name,delivery date and Grossamount in my calculated view.i am trying to create calculated column where i need Grossamount in two columns based on delivery date.I have 2012 and 2013 as values for my delivery date.so i have created two column as grossamount_2012 and grossamount_2013.if i have delivery date as 4thdec,2012 i want the grossamount value to be in coloumn grossamount_2012 and the grossamount_2013 should be blank.i have written an expression like this
if("Deliverydate" <= longdate(2012-12-04),"Grossamount","0")
and it looks like this is wrong.i am getting the text Grossamount rather than values for that field in my output.so can anyone help me please?Hi chandra
i am trying to get the same result by using sql script and CE functions.i have written the following code
select A."PRODUCTID",
E."TEXT" as "PRODUCTNAME",
C."COUNTRY",
D."DELIVERYDATE",
Sum(D."GROSSAMOUNT") as "GROSSAMOUNT"
from "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.Products" as A
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.BusinessPartner" as B
on A."SUPPLIERID" = B."PARTNERID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.Addresses" as C
on B."ADDRESSID" = C."ADDRESSID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.Purchase.Item" as D
on A."PRODUCTID" = D."PRODUCTID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.Util.Texts" as E
on A."NAMEID" = E."TEXTID"
GROUP BY A."PRODUCTID",E."TEXT",C."COUNTRY",D."DELIVERYDATE";
this is working fine but i want to split the grossamount based on current year and last year.Any idea how to do this
In calculation view using script can we use if and case statements? -
Calculated Column using IF statement with DATEIF formula
I have a dated column that includes a date when a position is vacated otherwise the field is blank if the position is still filled. I want a calculated column to return the number of days the position has been vancant from the date that is listed to today.
So the following was entered & works.....
=DATEDIF([Vacancy Date],Today,"d")
The delima is that it is also returning a value when there is no date in the dated column but it returns a funky number 42,069. What I want it to return when the dated column is blank is blank or zero would work too. I don't know how to incorporate that
into this formula.You are correct it no longer reads that column as Today.... So is there anyway to make this a calculated column for my purposes?
I'm going to use SharePoint list for a Position Pool & managing positions within a large department. What I'm attempting to do with this column is have a current count of the number of days since a position has been vacant. Our system that I pull the
position data from will give me the vacancy date for those positions & where the position is filled the date field will be blank. So I'm wanting this column to return a 0 when the position is listed as filled & the number of days vacant based on the
vacancy date column I have. Is there any way to make this work in SharePoint? Obviously I can make that work in Excel however my task was to load raw data into SharePoint & have SharePoint do the work if possible with little to no human intervention prior
to loading to SharePoint.
Thank you,
MMHagman -
DAX - IF statement and filters within calculated column
Hi all,
I've got a bit of a complex formula I'm trying to run, but I'm not quite there yet. I don't know where/how/if I can place a filter within my IF statement for a calculated column due to so many variables. I either get errors or wrong numbers.
Hope the following makes sense.
Here is my formula for the calculated column [Years Since Last Task]:
=IF (ISBLANK([Last Task Date]) && ([Current Role]<>BLANK()), DIVIDE([Quarters],4), FLOOR(1. * ( today() - [Last Task Date]) / 365, 0.25))
Problem: I am getting "114.25" for Ken....but I want a blank result instead. Meaning, I need to also filter out any name (row) who has a blank [Current Role]. How do
I add a filter to this current formula? Is one more step of filtering possible in this IF statement? (Maybe I shouldn't use an IF statement, and try CALCULATE instead?)
Below is the table 'Work' for you to see what's happening.
Name
Quarters
Last Task Date
Current Role
Years Since Last Task
John
1
1
0.25
Mike
4
2/7/2011
3
3
Todd
5
4/20/2009
4
5
Jeff
9/1/2013
3
0.5
Ken
0
114.25
Steve
2
12/3/2011
2
2.25
Nate
2
1/1/2014
2
0.25
Greg
1
8/11/2013
1
0.5
Ross
4
11/9/2010
4
3.25
Hope all this made sense. Let me know if you have any thoughts.
Thanks,
~UG1you can use nested IF-statements here:
=IF (ISBLANK([Current Role]),
BLANK(),
IF(ISBLANK([Last Task Date]),
DIVIDE([Quarters],4),
FLOOR(1. * ( today() - [Last Task Date]) / 365,0.25)
hth,
gerhard
Gerhard Brueckl
blogging @ http://blog.gbrueckl.at
working @ http://www.pmOne.com -
Creating a Status column (IF statement/calculated column)
I'm developing list for managing a project with 11 columns each representing a project milestone.
We'll call them A,B,C...K.
"A" representing a status of "Project Started" and K representing "Project Complete" with various statuses in between.
When a milestone has been reached, the date is input into the appropriate column. So when the project is complete, there will be dates in all columns A-K
I wish to incorporate a new column that indicates the current status depending on if columns A-K have been filled in.
So if all columns are blank, a status of "Awaiting start" is indicated.
If column A is filled in with a date, a status of "A" is indicated.
If columns A and column B are filled in then a status of "B" is indicated.
If columns A, B and C are filled in then a status of "C" is indicated. * * If all the columns are filled in with dates, a status of "K" is indicated.
Any ideas? Some form of If statement in a calculated Status column?Hello,
You can use nested if statement something like below.
For example, I have one column named as 'Score' and the requirement is to perform quartile breakup based on score so for that I can use below calculated formula in my calculated column.
=IF(INT(Score)>85,"85 Above"
,IF(AND(85>=INT(Score),INT(Score)>=80),"85-80"
,IF(AND(79>=INT(Score),INT(Score)>=75),"79-75"
,IF(INT(Score)<75,"Below 75","0"))))
Have below links for more details.
Calculated Field Formulas
Examples of common formulas
Thanks. Please mark it as an answer if it helped. -
CASE statement in Calculated column
Hi Frzz,
I have below requirement in Calculated column with CASE statement. Could some one help me how to achieve this with case statement.
String = 0Hello
01Hello
012Hello
0123Hello
If 1st Character of the string is '0' then - 0Hello
1st 2 characters of the String is '01' - 22Hello
1st 3 characters of the String is '01' - 333Hello
1st 4 characters of the String is '01' - 4444Hello
Thank you.
Best Regards,
Krishna.Hi Krishna ,
Using IF and MATCH to do that: ( I took one of the conditions you specified )
IF(match("STRING1",'??0??'),'333Hello',"STRING1")
Output:
Regards,
Krishna Tangudu -
If statement for calculated column
Hi, I need to know if its possible to do the following in a calculated column
if column1 value => 1
display the name of column1 + the value of column 1
is this possible?Hi hein,
You can return your calculated column value as "Number" type, set the "blank space" in your formula, see the formula as follow,
=IF([A4 Printing Paper Box]>0,"[A4 Printing Paper Box]"&[A4 Printing Paper Box]," ")
http://msdn.microsoft.com/en-us/library/bb862071.aspx
Thanks
Daniel Yang
TechNet Community Support -
Need help with a calculated column - is there any way to reference a value in the current row?
Hey guys,
I'm a bit of a DAX newbie, and I'm running into a block. I'm creating a Power View report about IT tickets. We are going to be creating a cube to automate the data soon, I'm currently working with a flat Excel Data Table of data to demonstrate the Power
View reporting capabilities to the team. I need the default display to show the top 4-5 items basked on the Ticket Count. The three applicable columns I'm using are the TicketID, the ContactReason, and the AssetCategory - all three are
text. One slide will show the top five Contact Reasons by Ticket Count, and the other will show the top five Categories by Ticket Count. The users will see this default view, but will be able to change it to see differently ranked items or can clear the
ranking slicer altogether.
What I've accomplished so far is to create the Calculated Field [Ticket Count] = COUNTA(Table1[TicketID])
And 2 other calculated fields:
[Contact Rank] = RANKX(ALL(Table1[ContactReason]),[Ticket Count],,,DENSE)
[Asset Rank] = RANKX(ALL(Table1[AssetCategory]),[Ticket Count],,,DENSE)
If I were creating a Pivot Table, this would be great. These fields calculate everything the right way. The problem is, I need to have a Rank slicer on each slide and the calculation by itself contains no data - with no data, there's nothing to slice. I
realized I need to actually have columns of data so I can create a slicer. I need each row of the table to show the same [Contact Rank] for every instance of a particular ContactReason (and the same for the [Asset Rank] and AssetCategory).
The RANKX formulas pasted into the Calculated Column section only show a value of 1 - with no Pivot table summarizing the fields, it's counting each row's ticket once, giving every line the tied Rank of #1.
I've solved the problem in Excel by creating 2 Pivot Tables on a separate sheet that have the data field and the calculated field for ContactRason and AssetCategory. Then on my Excel Data Table, I've added two columns that do a VLOOKUP and pull over a the
Calculated Rank from each Pivot Table that match the ContactReason and AssetCategory fields. This works on the flat Excel Data Table now, but will not be a solutions when we start pulling the data from the cube (and there is no flat table).
What I think I need is an Expression for the RANKX formula that can give me, for each row, the count of all of the times a ContactReason shows up in an entire column. There's only about 100,000 lines of data and each ContactReason or AssetCategory
may show up several thousand times. But if I can get the expression to return that count, then the RANKX formula should work in the Column. If it wasn't a DAX formula, I'd use a COUNTIF and say 'Count the entire ContactReason column anytime it's equal to the
ContactReason on THIS row', but in DAX I don't know how to reference a single value in a row. I've tried the CALCULATE() formula, but it seems like the filter needs a specific value, and doesn't work on a dynamic "cell" value.
Any help would be greatly appreciated! (I hope it all makes sense!)If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
=
RANKX(
ALL(Table1),
CALCULATE(
COUNTROWS(table1),
ALLEXCEPT(Table1, Table1[ContactReason])
DENSE
If this has missed the mark, would it be possible to clarify the requirement further?
Regards,
Michael Amadi
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
Website: http://www.nimblelearn.com
Blog: http://www.nimblelearn.com/blog
Twitter: @nimblelearn -
Two separate calculated columns - results show up only in one of them
Hey,
I've recently run into some peculiar behaviour in OBIEE (Oracle Business Intelligence 11.1.1.7.0). I'm using three attribute colums (deliv. on time, ordered, backlog) to calculate a monthly service level. In addition I'm using a customer ID number to separate our customers into export and national customers. I've three calculated columns - Service Level Export, Service Level Total and Service Level National. I'm using a simple case-statement to distinguish between international and national customers (When custID between xxx and yyy then...). The total service level column doesn't have a case-if calculation, only a couple of simple mathematical operations and it works fine.
Now the problem is that the results show up only in one of those calculated columns containing case-if calculations - not both at the same time. Using a prompt in a pivot table I can verify that both columns get proper values but when I remove the prompt half of the values randomly disappear from these columns so that only one of the columns has a value for a specific month. The calculations in all three columns are identical - the only difference is that Serv. L. Exp. exludes a spesific CustID whereas the Serv. L. Nat. only includes that one CustID.
Example - both Serv. L. Exp and Serv. L. Nat should have values for every month, now only one of them gets values
Month Serv. L. Exp. Serv. L. Nat. Total Serv. L.
01 15 % 15 %
02 17 % 17 %
03 13 % 13 %
04 20 % 20 %
05 22 % 22 %
I've a few months of OBIEE experience under my belt so I'm not that experienced but usually I've been able to figure out what's wrong on my own. This time, however, this leaves me dumbfounded. Any help or advice would be much appreciated.
Regards,
SilverHi,
Serv.L.Nat is calculated 100 * INVOICED / (ORDERED + DELAYED). For National Service Level the case statement (including the calculations) is as follows (the inner CASE limits the Serv.L.Nat per cust to a range of 0 - 100 %):
CASE WHEN "fact"."CustID" = 100001 THEN (
CASE WHEN Serv.L.Nat > 100 THEN 100
WHEN Serv.L.Nat < 0 THEN 0
WHEN Serv.L.Nat IS NULL THEN 0
ELSE Serv.L.Nat
END)
END
For Export the sql is exactly like the one above, barring the reversed condition.
Regards,
Silver
PS. The above is a burst of pseudoSQL so don't mind the typos, the actual code is tested to work as intended... barring the fact that something's wrong with getting the values to appear. -
Calculated Column with Null date end result needs to be text.
Good Morning,
I am using SharePoint 2010 and am trying to create a calculated column converting a date/time column to to show just a month and day. Calculation is
=TEXT([Anniversary],"m/d")
This is to enable sorting on the month. And this works fine except when there is no date entered in the "Anniversary" column.
I have tried to modify the formula in this column to no avail. http://social.technet.microsoft.com/Forums/sharepoint/en-US/0c9d5ae1-132a-4e02-8a91-c54708919d9a/show-calculated-date-column-as-null-when-there-is-no-date?forum=sharepointgenerallegacy
I do not have access to modifying the code so have to work strictly OOB. Any help would be greatly appreciated.I would think you could add an IF statement to verify if the text is null. So...
=IF(ISNULL(TEXT(Anniversary, "m/d")), What we do when null, TEXT(Anniversary,"m/d"))
Andy Wessendorf SharePoint Developer II | Rackspace [email protected] -
Calculated column - non-rolling rowsum where columns are not null
I have a calculated "Year total" column that sums 12 month columns. In our business $0.00 is not the same as null, so i have some columns without numeric data. My calculated column is only working when there is numeric data in all 12 months and i need it to work for rows where some columns are null.
Is there an easy way around this?Figured out how to do this using the IFNULL function.
-
How to calculate the total of a calculated column in a list view at the end of the view?
I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
the price and quantity but not with the total column. how do I do this?You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
Cheers,
Maybe you are looking for
-
Year-old MacBook adequate for PhotoShop?
My friend is a bit of a computer klutz and has a MacBook bought over a year ago. He was ready to buy an expensive Mac Pro desktop machine today for Photoshop work but I told him his MacBook would probably be powerful enough, and if not, an iMac would
-
Ipod Touch Sleep/Wake button not working
Okay people I've had my 1st generation iPod touch since April of 2008...all of a sudden ( a few months ago) my sleep/wake button just stops working. Then recently it began to work again like for 4 days and then it just S T O P P E D ....A G A I N!!!
-
Capacity Requirement in each capacity category
Hi experts, I have some queries about capacity category in project as follow scenario: 1. I have a work center NLE0001 including 2 capacity category that are PERSON and MACHINE. 2. Then I assign this work center to a internal activity in PS. In detai
-
I have a new 27 inch i Mac which works well, except the App store app will not open, and when it is attempting to, my network crashes. What do I need to do? Mark
-
Hi all, associated with a button is the following cod eon HTML page: onClick="if(validateAddress(this.form)) displayResult(this.form);" In validateAddress Is this code: return=false; In displayResult is: var outTable; var validateAddressret