Dynamic background color for total cell - pentaho

I'm using Pentaho Report Designer and I would like to change the background of the cell that contains the sum of all the measure values of a column based on the calculated value. For the measure values, this can be easily done defining a formula for the background property like the following one:
=IF([measure] >10; "red"; "green")
However, from the cell that shows the total, [measure] is always null.
How can I get the value of the cell (or the result of sum all the measure values)?
Thanks

Finally I've found how to do this. It is necessary to create a function to sum the values so it can be referenced later from a formula:
Create a function to calculate the total (Add Function... > Summary > Sum)
Inside the properties table, select Field Name for the function. Give it a Function Name to make reference to the formula later (i.e. budgetTotal)
Use the function to apply the conditional formatting based on its value (i.e. =IF([budgetTotal] >10; "red"; "green"))

Related

Change the color of x number of cells based on the numeric value from another cell (in multiple rows)

My question is basically the same as this one (Change the color of x number of cells based on the numeric value from another cell) with one extra condition: for multiple rows.
enter image description here
So on the left side, there's a column "PTO 2018 Total" (range= I3:I80) and I want to color each row (range= J3:S80) based on the number of the column I, like I manually did for the first two rows.
Thank you so much in advance.
Use conditional formatting:
Use a formula rule with the formula:
=AND(COLUMNS($J1:J1)<=$I1,ISNUMBER($I1))
Applied to
=$J:$S

Lookup most used text in range based on criteria

I have the following CSE formula to return the most used text in a range,excluding empty cells.
=INDEX(A4:D4,MODE(IF(A4:D4<>"",MATCH(A4:D4,A4:D4,0))))
My problem is that the formula returns #NA when there is only one value in the range. How can I adjust the formula to return that value?
If only concerned with a single cell being present causing problems and wanting to retrieve use this CSE:
=IF(COUNTIF(A4:D4,"*"), INDEX(A4:D4,MATCH(FALSE,ISBLANK(A4:D4),0)),INDEX(A4:D4,MODE(IF(A4:D4<>"",MATCH(A4:D4,A4:D4,0)))))
Otherise, with all distinct values being present or no mode in general,
You can count the distinct values and use that tested against the number of columns. If equal there is no mode and so use If statement to default into handling the True.
=IF(SUMPRODUCT(1/COUNTIF(A4:D4,A4:D4))=COLUMNS(A4:D4),"Do Something",INDEX(A4:D4,MODE(IF(A4:D4<>"",MATCH(A4:D4,A4:D4,0)))))
Again, a CSE so enter with Ctrl + Shift + Enter.
This bit of above formula counts the unique values:
SUMPRODUCT(1/COUNTIF(A4:D4,A4:D4))

sum function in GREL in OpenRefine

In OpenRefine, I'm trying to increase the value of every number in a column by 1.
The GREL expression sum([value],1) gives me Error: sum expects an array of numbers.
I guess I don't know how to produce an array of numbers. When I use a different function on the same column, such as tan([value]), I get the result I want.
I think you misunderstood the use of sum(). If you just want to add 1 to each cell, just use value + 1.
Make sure, however, that your column contains numbers (in green) and not strings (in black). If in doubt, use toNumber(value) + 1 instead.
The sum() function allows to add all the numbers contained in an array, for instance sum([1,2,3,4]) = 10, but you have no array if each cell of your column contains a unique number.

Display Value from PowerPivot FieldList

I want to show a value in a cell of Excel which is coming from PowerPivot Field List.
How to show its value in Cell?
You have a couple of options to show a value from a Power Pivot model in a cell in Excel.
1) Create a pivot table with only the values for the field that you want. You can do this by opening your Power Pivot model and clicking Pivot Table on the home tab. Locate the field you want and put it in the Rows. You can remove the grand total by going to the design tab in the PivotTable Tools group and choosing Grand Totals -> Off for Rows and Columns. You can type your own heading in the row that says row labels.
2) Use a slicer. Add a pivot table, then click Slicer on the Insert tab. Select the field you want to show and click OK. You can delete the rest of the pivot table if you don't need it.
3) Use cube functions. You can get a list of values for a certain dimension by creating a set and then cuberanked members. For example, I have a Power Pivot model with a field called cities. My cube set is in cell G1.
=CUBESET("ThisWorkbookDataModel","[Location].[City].[All].children", "Cities")
In the cells in column G below G1, I can copy the following cuberankedmember formula.
=IFERROR(CUBERANKEDMEMBER("ThisWorkbookDataModel",$G$1,ROW()-1),"")
This gets the list of members from the set in cell G1 and lists out the member in order. so you need to copy that to as many cells as there are values. I used ROW()-1 to create an autonumbered list that starts with 1. So in cell G4, I'm saying "get me the 3rd city. Since the number of members can change, I added the IFERROR. Normally, if you ask it for more members than are present, it will return #N/A. IfError catches that error and returns a blank string instead (this is purely for cosmetic purposes and can be left out).
You can see the results of the 3 options below.

SSRS 2005: Dynamic Background Color for Cells, Excluding Subtotal Cells

I have an expression in place in my report to change the cell color if the value of the cell is above a certain threshold. It's just an expression setup in my text box called "percent" - on the background color property. Looks like this:
=IIf((FormatPercent(Sum(Fields!items.Value)/First(Fields!totalItems.Value),2) >= .04 & "%"
And First(Fields!errorCodeAdjType.Value) = "Error1")
Or (FormatPercent(Sum(Fields!items.Value)/First(Fields!totalItems.Value),2) >= .02 & "%"
And First(Fields!errorCodeAdjType.Value) = "Error2")
,
"Maroon", "Transparent")
It works as I want it to; however, it is also changing color of my subtotal cells. How can i write this better to make sure it doesn't think that one of my subtotal cells meets the cell color criteria? Thanks!
You can set the background property individually for different cells. Sounds like you've defined this for multiple cells. Clear the BackgroundColor property for the cells that are in the subtotal row.
If you don't have a separate subtotal row defined in the report, then you'll need to add a condition that can distinguish subtotal rows from detail rows. I strongly recommend that you create the subtotals by using SSRS groups, not as subtotal rows included in the query. That is, avoid WITH ROLLUP.