How to divide all bars in bar chart by specific bar value in TIBCO Spotfire? - bar-chart

I am aiming to create a percentage growth Bar chart. The percentage is on basis of any one specific bar value.
For example, I have 5 fruits (Apple, Banana, Cherry, Dates, Mango) and their repective sales. The user selects a primary fruit (E.g Apple) and than selects a secondary fruit (E.g Mango). Both primary and secondary fruits are selected using different Property controls. The result of user selection is displayed on a cross Table. (With the vendors on Vertical axis).
What I want to do is, select an row, that row will have sales of both primary and secondary fruit, I wish to display that how much percentage sales of secondary fruit is more than of primary.
So, If Primary fruit have sales of $ 100 and secondary fruit have sales of $ 120, the bar chart should show Primary fruit bar as 0 % and secondary fruit as 20 %.
Primary fruit will always have a bar of 0 %.
Hope I am clear now.
Is this possible is Spotfire?
TIA.

Related

How to group in MySQL a column with multiple choices under only one of them?

I have a table in which a certain column's data is sometimes missing, in which cases has just a dash.
But since there's another column which is unique, the missing data can be deduced from other rows.
In other words, I have something like this:
Unique model
Maker
Profit
abcd1234
-
56
zgh675
Company Y
40
abcd1234
Company X
3
zgh675
-
10
abcd1234
Company X
1
Which query can I use to automatically reach the following (the list of Makers is dynamic but every model can only go to one of them):
Unique model
Maker
Profit
abcd1234
Company X
60
zgh675
Company Y
50
?
You may aggregate by unique model and then take the MAX value of the maker, along with the sum of the profit:
SELECT model, MAX(maker) AS maker, SUM(profit) AS profit
FROM yourTable
GROUP BY model;
This approach should work assuming that each model only has one unique non NULL value.

How do I create a single bar chart from three independent data sources?

Input
I have three datasets (simplified example below):
List of students from school A and their age (1200 records)
List of students from school B and their age (200 records)
List of students from school C and their age (2000 records)
Every dataset has two columns: studentId and age.
Desired result
I want to create a bar chart that shows the distribution of age across these schools. For easy comparison I would like to have:
one bar chart
with three legend entries:
A
B
C
7 categories:
age =< 12
age = 13
...
age >= 18
What I have tried
I tried linking the datasets, but due to the different number of students and the various studentId formats per school this did not work.
I tried using the studentId columns of the three datasets as the value and the age column of every dataset as the axis. This only worked one dataset at a time. I needed to "Go to the next level in the hierarchy" to see the other dataset.
How else can I achieve this?
You can go into Power Query Editor:
And you will need to add a new column for each datasheet with the legend you want, for example:
So your tables should look like this:
Then merge the tables with Append Queries as New:
Select Three or more tables, and add the three tables:
And there you have your three tables merged into one.

Crystal report - 2 logic in single column

We have requirement in Crystal report where we have to implement 2 concept in one column.
For eg: in below screenshot,
 if we have numbers we need to sum up and display as one row.
 if it is variable row. It should remain as single row.
Material Quantity Price
O Ring 1 5.61
O Ring 1 Fixed
O Ring 1 5.61
O Ring 1 Fixed
Output should be,
Material Quantity Price
O Ring 1 11.22
O Ring 1 Fixed
O Ring 1 Fixed
Kindly pour us some suggestions if any.
First note that your current table design is very flawed, because you are trying to store numeric and text information in the same Price column, both as text. This means that to sum up any prices, we have to cast to a number, and then cast back again to text to report with the other text only values. You would be much better off not storing text in the Price column, and making that column numeric.
That being said, the following query appears to do what you want:
SELECT
Material, MAX(Quantity) AS Quantity,
CAST(SUM(CAST(Price AS numeric(9,2))) AS varchar(15)) AS Price
FROM yourTable
WHERE Price <> 'Fixed'
GROUP BY Material
UNION ALL
SELECT Material, Quantity, Price
FROM yourTable
WHERE Price = 'Fixed';
Demo

Better to have one master table or split into multiple tables?

I am creating a database and I am unsure of the best way to design my tables. I have a table of real estate properties and I want to store information about those properties - e.g. bedrooms, bathrooms, size... I may have additional information I want to store in the future if it seems useful - e.g. last purchase price or date built, so I need to be flexible to make additions.
Is it better to create a separate table for each "characteristic" or to have one table of all the characteristics? It seems cleaner to separate the characteristics, but easier programming-wise to have one table.
CHARACTERISTIC TABLE
id property_id characteristic value
1 1 bedrooms 3
2 1 bathrooms 2
3 1 square feet 1000
4 2 bedrooms 2
...
OR
BEDROOM TABLE
id property_id bedrooms
1 1 3
2 2 2
...
BATHROOM TABLE
id property_id bathrooms
1 1 2
...
Forgive me if this is a stupid question, my knowledge of database design is pretty basic.
I would suggest a middle ground between your two suggestions. Off the cuff I would do
property table (UID address zip other unique identifying properties)
Rooms table ( UID, propertyID, room type , room size,floor, shape, color, finish, other roo specific details ect..)
Property details (uid, propertyID, lot size, school district, how cost, tax rate, other entire property details)
Finally a table or two for histories eg.
Property sales history(UID, PropertyID , salesdate, saleprice, sale reason, ect..)
Often grouping your data by just "does it match" logic can yield you good results.... care needs only be taken to account for 1to1 and 1tomany relationship needs of tables.
I am focused to this:
"I have a table of real estate properties"
Now as far as i knew you has to be a different type of:
Houses
Bedrooms
Comfort room and so on.
For further explanation:
You has to be a table of:
1. House type
2. House names,description,housetypeid,priceid,bedroomid,roofid,comfortroomid and any other that related to your house.
3. Bedroom type
4. Comfort room type
5. Dining type
6. roof type if it has.
7. House prices
8. Bathroom type
something like that.
One table with a few columns:
Columns for price, #br, #bath, FR, DR, sqft and a small number of other commonly checked attributes. Then one JSON column with all the other info (2 dishwashers, spa, ocean view, etc).
Use WHERE clause for the separate columns, then finish the filtering in you client code, which can more easily look into the JSON.

SSRS Show a percentage of a a total value

I have a regular Table in SSRS. With 3 Groups...
(Parent) STORE - CLERK - PRODUCT (Child)
I have some regular aggregations. How many PRODUCTS Sold by a CLERK , How Many CLERKS Per STORE and Eventually How many PRODUCTS Per STORE
On top of the Regular Sums And Avgs, I need To Find Out The Percentage of PRODUCT (Type) Meaning a Particular value of that Group.
Example STORE 001 Has Sold 10 RADIOS (a PRODUCT) and There has Been 100 RADIOS sold by all Stores
So Basically What I Need is to show STORE 001 is Responsible for 10% of all RADIO Sales.
(A note: Ideally , I would Like to show this To adjust to the Data - So if I add new products It will group those as products (Naturally) but still give me those percentages)
= fields!product.value / sum(fields!product.value)
in its most basic form you would want to use something like this.
The first will give you the total of the current row of data and the second will give you the total of all rows of that product.
Thus you would have 10 / 100 (per your example).
This is assuming that you have your data structured correctly. Depending on the structure of you report you may need to add a scope to your total summation to make sure that you are not totaling any other datasets that may reference the same product or field.
sum(fields!product.value, "--your dataset here--")