Show Different category name in tooltip in spotfire bar chart - tibco

We have a requirement for showing ID in category axis and description of same ID in tooltip.
I have multiple columns in my data like value 1 ,value2,value 3 etc. value 1, value 2 are columns.
I am putting this on value axis as an expression like Sum([value 1]) as [AC 6076 ], Sum([Value 2]) as [AC 6078 ], etc. that is this will hardcoded as IDs in category axis
So my category axis is column names. that is <[Axis.Default.Names]> .
please see the attached picture. It's the description against a column not a row.
It would be an expression in tooltip which may be something like
First(Case when '${Axis.Y.DisplayName}'='AC 6076' then "description 1" when '${Axis.Y.DisplayName}'='AC 6078 ' then "description 2" else " Description 3" end )
This expression is not showing correct value. it wil always show "Descrition 3"
i want to show this IDs(column names in category axis) and a description for each of these column names in tooltip. please have a look at the picture attached.
Atatched picture
Thanks

First(CASE
WHEN '${Axis.Y.DisplayName}'='AC 6076' THEN "description 1"
WHEN '${Axis.Y.DisplayName}'='AC 6078 ' THEN "description 2"
ELSE " Description 3"
END)
this always evaluates to your ELSE condition because ${Axis.Y.DisplayName} will always be the full display name for the axis, not the individual columns (i.e., "AC 6076, AC 6078").
you will need to add your description text to your data somehow. this is a little convoluted and will require some tweaking on your end, but the principle is the same.
this is assuming your table is something like this:
key val1 val2
a 1 4
b 2 5
c 3 6
from the menu, select File..Add Data Tables...
click Add then select the data table powering your visualization from the From Current Analysis heading
expand the Transformations pane at the bottom of this dialog
choose a Pivot transform and click **Add...*
leave everything default except for Transfer columns..., where you should add only the columns you wish to sum (e.g., [value 1] and [value 2])
OPTIONALLY change the naming scheme to just %T
click OK
your table now looks like (ignoring optional steps):
Sum(val1) Sum(val2)
6 15
choose another transform, this time Unpivot, and click **Add...*
add all columns to Columns to transform
click OK
now you have:
Category Value
Sum(val1) 6
Sum(val2) 15
choose one last transform: Calculate new column and click **Add...*
enter your case statement that will determine the description and name the column "Description" or something
click OK
click OK
your final table will resemble:
Category Value Description
Sum(val1) 6 This is the sum of value 1
Sum(val2) 15 This is the sum of value 2
on your bar chart, the category axis expression should be Category and value should be Sum(Value) (assuming you didn't change the column names in step 9)
add a new line to the tooltip with an expression First([Description]), or whatever you named the new column in step 12
whew. it's a lot of steps but it works. the goal is to get the description data into it's own column so you can put it in the tooltip. since your data is aggregated and doesn't exist in its own column, this is the only way I can think of doing it.

Related

Google Sheets - How to Combine Filter Function with Filter View

I've been working on a spreadsheet with over 100 rows, and found a hacky way to incorporate a "hide" checkbox that will hide any row where column C matches a specific value (building type), specified beside the box. To do this, I first created a function like this: =FILTER(Data!A1, OR(Data!$C1<>$O$2, $P$2)) and dragged that across every row and column in a seperate sheet. This reads as, "Display current cell if the corresponding column C in that row in Data does not match the building type, or if the the checkbox is checked. This way, the whole row is hidden when the building type matches, and the box is unchecked. A1 adjusted to each row individually, $C1 referenced the building's type, $O$2 referenced the targeted type to potentially hide, and $P$2 was the checkbox.
Problem #1: This created a lot of formulas in hundreds of cells, and when the building type was not found, it displayed #N/A across the entire row. A Filter View was able to hide these values, but it was inconvenient to have to reset the values every time I wanted to hide or unhide another building type.
My Attempt to Fix: I used a filter function once again to recreate the entire sheet from one cell, hiding the appropriate rows, using this: =FILTER(Data!A2:J191, ARRAYFORMULA((Data!$C2:C191<>$O$2)+(Data!D2:D191*$P$2)) This is the hacky part. I multiplied the checkbox's "true" by an array arbitrary positive numerical values in the D column to "OR" it with each building type value to achieve the same goal as before, but for EVERY cell.
Problem #2 arose: When I get my beautiful sheet, I can not sort it via a filter view, or it will throw an error and display nothing. I'm resorting to sorting the original tab, but intend to have it be ignored entirely. So how do I combine these two, Filter View, and Filter Function, to create a nice spreadsheet where I can SORT AND HIDE rows?
Bonus Problem #3: To add more buttons, my formula is this: =FILTER(Data!A1:J191, ARRAYFORMULA((Data!$C1:C191<>$O$2)+(Data!D2:D192*$P$2)), ARRAYFORMULA((Data!$C1:C191<>$O$3)+(Data!D2:D192*$P$3)), ARRAYFORMULA((Data!$C1:C191<>$O$4)+(Data!D2:D192*$P$4)), ARRAYFORMULA((Data!$C1:C191<>$O$5)+(Data!D2:D192*$P$5)), ARRAYFORMULA((Data!$C1:C191<>$O$6)+(Data!D2:D192*$P$6)), ARRAYFORMULA((Data!$C1:C191<>$O$7)+(Data!D2:D192*$P$7)), ARRAYFORMULA((Data!$C1:C191<>$O$8)+(Data!D2:D192*$P$8)), ARRAYFORMULA((Data!$C1:C191<>$O$9)+(Data!D2:D192*$P$9))) This is ugly, and very slow to load. Is there a way to create a function range to handle the same checks on multiple rows, and crunch it into a single formula?
Here is another monstrosity (this one has less repetition) for you:
=QUERY(
{IGNORE!A2:J, IGNORE!P2:P},
"SELECT * "
& "WHERE Col3 is not null "
& IF(COUNTIF(P2:P9, False) = 0, "", "AND NOT Col3 MATCHES '^" & JOIN("$|^", IFNA(FILTER(O2:O9, P2:P9 = False))) & "$' ")
& IF(COUNTIF(A2:K2, ">0") = 0, "", "ORDER BY Col" & JOIN(", Col", IFNA(FILTER(COLUMN(A2:K2) & IF(COLUMN(A2:K2) = 1, "", " DESC"), A2:K2)))),
0
)
Your checkboxes should remain. The second row can have just True/False values, no need for column number (a simple change will be needed COUNTIF(A2:K2, ">0") -> COUNTIF(A2:K2, True)). Also consequent sort works now (but only in the actual order of columns: if checked 1, 3, 4 then it will be sorted first by 1, then by 2, then by 4). You could place another config table on the right about sorting, where you would select all the columns you wish to sort by, their mutual order, and desc/asc for them.
Edit: added IFNA so FILTER won't return an error, changed multiple ANDS to MATCHES and simple regexes.

OBIEE TOPN On Result of Union Two SubjectArea

I used "Union" to combine two different subject area in an analysis in OBIEE 11 :
"A" is a column in the first subject area with formula that needs
"A_Dim" to be calculated using "A_Dim" and Case-When (So I Should Use "A_Dim" in first subject area then exclude it in result)
"A" equals to zero in second subject area
"B" is a column in the second subject area
"B" equals to zero in first subject area
"C" is a column in Result (Using Add Result Column) that has this formula :
SUM("A" BY sth ) / SUM("B" BY sth)
("A","B",... replaced with saw_i in result column formula as you know)
the problem is, I can not get top 10 rows ordering by "C" ??
(I tried using RANK, TOPN , TOPN(RANK()),... with no luck)
(and one more thing, there are two problem with using "Narrative view" instead of other views , first they want a bar chart, besides in narrative there is no Exclude option and I should use javaScript to get top 10 from thousands of repeated "C" values)
The original question is old, but I figured I would add my solution in case anyone ends up here like I did.
I was able to create a "Result Column" with my TOPN formula. I did not have to create equivalent columns in the two queries that are being unioned (aka there are 4 columns in each union query but 5 columns in the "Result Columns" overall). It seems to work as expected.

Filter Previous Data DAX on condition

Imagine I have the following dataset.
Product / IsOpen / Date
1 / 0 / 21 / 05 / 2009
1 / 1 / 22 / 05 / 2009
How can I filter/delete data previously to the first IsOpen = 1 ??
By creating a new table or even in Powerquery.
I just want data starting from its first IsOpen = 1.
Thanks!
Starting with this table in Power Query:
Sort by the "Date" column. (Click the down arrow button at the top right of the "Date" column and then select "Sort Ascending".) The table will basically look the same, except the dates will be in order and the down arrow button will change to this:
Add an index. (Click the "Add Column" tab and then "Index Column".)
Group by "IsOpen" and determine the minimum index value for each "IsOpen" value. (Click the "Transform" tab and then "Group By". Then fill in the pop-up window like this:
...and click "OK".) You'll see this:
Filter out the 0's in "IsOpen". (Click on the down arrow button at the top right of the "IsOpen" column and then deselect "0" in the list.)
You'll see this:
Remove the rows with 0's in "IsOpen" that occur before the first 1. (Here is the "trick" that does what you want. I found it on Ken Puls's blog, "The Ken Puls (Excelguru) Blog":
Click the "Fx" to the left of the formula bar and overwrite what appears with this:
= Table.Skip(#"Added Index",#"Filtered Rows"[MinIndex]{0})
Then press enter and you'll see this:
Notice the 0 "IsOpen" that occurred before the first 1 "IsOpen", which was at "Index" 0, is now gone.)

Counting a field value response weekly basis in Lotus Notes

I have radio button field in a form whose value can be 1 or 2 or 3. I have a made a view out of this form and there one column will contain the value of this radio button field . Whenever a customer submits the form, a new document will appear in the view. A customer can submit the form many times with different value of this radio button. Is it possible to know how many times a particular customer selected the value 1?
Yes, you can create a view where the first column is your customer name and the second column is their response. Both columns should be "categorized" meaning they'll group the like values.
For each column you can set the formula to include the number of documents within the group. For example:
CustomerName + " (" + #DocChildren + ")"
will show you "ABC Company (12)" if ABC had 12 responses.

Spotfire Expression Value for Max(Row Count)

I'm trying to make a Calculated Value Control expression on the below columns:
Row Count | Date | Value
What I want to get is the Value for the 'newest' date, which will also be the highest row count. How can I write an expression to get this, it seems like it ought to be simple. I'm having trouble writing it in only expression language, without SQL.
Using the expression below you can limit the records in your table to those with the highest (aka most recent) date which should have your Value of interest.
[Date] = Max([Date])
You can do the same with row count since you mentioned the record of interest being the highest row count:
[Row Count] = Max([Row Count])
If you're looking to create a calculated column you can use a case statement to spit out the value:
case when [Date] = Max([Date]) then [Value] end
Lastly, should you want to display this value in a Text Area to show off your value you can utilize the calculated column above:
1) Create a new Text Area
2) Type some text about what it is: "Value for newest Date: " (optional)
3) Click "Insert Dynamic Item" -> "Calculated Value"
4) Under "Data" ensure the appropriate data table is selected. Note: You can uncheck the "Use Current Filtering..." box here if you do not want your value to update as you filter.
5) Under Values, utilize our calculated column with "Max" wrapped around it to avoid Summing duplicate values:
Max(CALCULATED_COLUMN)
Here is a screenshot of my work with random filler dates and values: http://i.imgur.com/hFapS8c.png
The larger text is to show the calculated value dynamic items. I used Max([Date]) for the date value.

Resources