TIBCO Spotfire - How to divide two calculated values on graphical table? - spotfire

Edited : Attached picture should explain.
All what is need is to add something to below expression in order to get the percentage % of Accepted and Rejected out of All

You can use expression like sum(if( [Tx Status] = "Accepted",[Value/Cloumn]) this will add only rows that have [Tx Status] = "Accepted"
but if You filtered out [Tx Status] you will not see any data :)

Related

TABLEAU - How to use aggregated values within STR function

My data in Tableau is in pivot format.
Region/City/Neighboor/Street columns, metric column with different numerical metrics and a column "Measure" that stores the given metric's value.
I want to create a calculated field and combine the SUM(Measure) if metric=A with some text
I tried creating a calculated filed as "Some Text" + STR(SUM(IF metric='A' THEN Measure END))
I receive an error "Cannot mix Aggregate and Non Aggregate Arguments" Is there any way to mitigate this issue ?
Thank you
Already the measure is aggerated try using this : "Some text" + str(if ATTR([Region])='Europe' then Measure_value end)

Filtering Data in Multiple Tables with the Filter Function (Excel)

I'm trying to return data from multiple tables based on a date. Each table has employee schedules with different tasks and I'd like to join these on a master output sheet that is dynamic with a formula.
=IF(A27=I27,FILTER(Employee 1,(Employee 1[Day]=D27)*(Employee 1[Name]=A27),"NA"),IF(A27=I28,FILTER(Employee 2,(Employee 2[Day]=D27)*(Employee 2[Name]=A27),"NA")
The above formula works if I toggle the employees name in a drop down list, but I'd like to have a "All" option that pulls in all of the employee names into the filter.
Something like this (the syntax is not correct):
=FILTER(Employee 1,Employee 1[Day]=D27),FILTER(Employee 2,(Employee 2[Day]=D27)))
Here is a photo of the summary I'm trying add a "all" option in the drop down.
[1]enter image description here
Any help would be greatly appreciated. Thank you in advance!
Very 1st of All, You are not allowed to use space in table names So, i changed your table names from Employee 1 and Employee 2 To Employee_1 and Employee_2
Now You can Use this formula to get the required result
=LET(name1,I27,name2,I28,tabname1,Employee_1[Name],tabname2,Employee_2[Name],daycheck1,Employee_1[Day]=D27,daycheck2,Employee_2[Day]=D27,x, FILTER(Employee_1,(daycheck1)*(tabname1=name1)), y, FILTER(Employee_2,(daycheck2)*(tabname2=name2)),rows1, COUNTIFS(tabname1,name1,Employee_1[Day],D27), rows2, COUNTIFS(tabname2,name2,Employee_2[Day],D27),myrows, SEQUENCE(rows1+rows2),cols,(IFERROR(COLUMNS(x),COLUMNS(y))),mycols, SEQUENCE(1,cols),IF(A27=I27,x,IF(A27=I28,y,IF(A27="All Employees",IF(myrows<=rows1, x, INDEX(y, myrows-rows1, mycols)),"NA"))))
Hope this works for you

Tableau: Multiple columns in a filter

I have three numeric fields named A,B,C and wants them in a single filter in tableau and based on the one selected in that filter a line chart will be shown. For e.g. in filter Stages B column is selected and line chart of B is shown. Had it been column A selected then line chart of A would be displayed .
Pardon my way of asking question by showing a image. I just picked up learning tableau and not getting this trick any where.
Here is the snapshot of data
Create a (list) parameter named 'ABC'. With the values
A
B
C
Then create a calculated field
IF ABC = 'A' THEN [column_a]
ELSEIF ABC = 'B' THEN [column_b]
ELSEIF ABC = 'C' THEN [column_c]
END
Something like that should work for you. Check out Tableau training here. It's free, but you have to sign up for an account.
Another way without creating a calculated field. Just pivot the three columns to rows and your field on which you can apply filter is created. Let me show you
This is screenshot of input data
I converted three cols to pivots to get data reshaped like this
After renaming pivoted-fields column to Stages I can add directly this one to view and get my desired result.

SSAS MDX Calculated Measure - COUNT of [ITEMS].[Item] grouped [Items].[Item Group]

In Excel connected to SSAS, I am trying to build a pivot table and add a custom Measure Calculation using "OLAP Tools" and/or "OLAP Pivot Table Exensions". I am trying to add a calculation that is really simple in my mind, but I cannot get it to work. The calc I need is:
GOAL: A record count of the [Items] dimension records grouped by any of the
[Items] dimension fields.
In particular I am trying to group by [Items].[Items Groups] and [Items].[Item]. Item is the lowest grain, so the count should return value "1". I have created a couple calculations that are kind of in the ballpark (see below). But the calcs don't appears to be working as desired.
What I have tried:
Attempt #1 -- [Measures].[Items Count (With net amount values)]
DISTINCTCOUNT( {[Items].[Item].MEMBERS} )
The calc 'Items Count (With net amount values)' appears to be
returning a decent count value, but it appears it only counts the Item
if there are transnational records found (not sure why). Also, when
at the lowest grain level the calc returns that value for the parent
group, not the dimension level selected on the rows.
Attempt #2 -- [Measures].[Items Count (All)]
[Items].[Item].[Item].Count
This calc returns the TOTAL item count for the entire dimension
regardless of the dimension level placed on the rows.
Attempt #3 -- [Measures].[Items Count]
COUNT ( { [Items].[Item].MEMBERS}, EXCLUDEEMPTY)
This calc freezes up Excel and I have to quit Excel. No idea why. I have seen this sytnax recommended on a few different sites.
Screenshot:
Help please? This seems really simple, but I am not very skilled with MDX. In DAX and SSAS TABULAR this would be very simple expression. But I'm struggling to count the rows with MDX in SSAS MD.
The "Outside Purchased Beef" group has 18 items with transactions, but 41 items in total. I do not know how to calculate the "41" value.
SSAS Excel-CalcMeasure-CountRows.png
Take a look at the following samples on AdventureWorks.
with member [Measures].[CountTest]
as
count(existing [Product].[Subcategory].members - [Product].[Subcategory].[All])
select
{
[Measures].[Internet Sales Amount],[Measures].[CountTest]
}
on columns,
{
([Product].[Category].[Category]
,[Product].[Subcategory].[Subcategory] -- comment this line for the second result
)
}
on rows
from [Adventure Works]
Now comment the indicated line for the parent view.

Excel Power Query - from web with dynamic worksheet cell value

We have a spreadsheet that gets updated monthly, which queries some data from our server.
The query url looks like this:
http://example.com/?2016-01-31
The returned data is in a json format, like below:
{"CID":"1160","date":"2016-01-31","rate":{"USD":1.22}}
We only need the value of 1.22 from the above and I can get that inserted into the worksheet with no problem.
My questions:
1. How to use a cell value [contain the date] to pass the date parameter [2016-01-31] in the query and displays the result in the cell next to it.
2. There's a long list of dates in a column, can this query be filled down automatically per each date?
3. When I load the query result to the worksheet, it always load in pairs. [taking up two cells, one says "Value", the other contains the value which is "1.22" in my case]. Ideally I would only need "1.22", not the title, can this be removed? [Del won't work, will give you a "Column 1" instead, or you have to hide the entire row which will mess up with the layout].
I know this is a lot to ask but I've tried a lot of search and reading in the last few days and I have to say the M language beats me.
Thanks in advance.
Convert your Web.Contents() request into a function:
let
myFunct = ( param as date ) => let
x = Web.Contents(.... & Date.ToText(date) & ....)
in
x
in
myFunct
Reference your data request function from a new query, include any transformations you need (in this case JSON.Document, table expansions, remove extraneous data. Feel free to delete all the extra data here, including columns that just contain the label 'value'.
(assuming your table of domain values already exists) add a custom column like
=Expand(myFunct( [someparameter] ))
edit: got home and got into my bookmarks. Here is a more detailed reference for what you are looking to do: http://datachix.com/2014/05/22/power-query-functions-some-scenarios/
For a table - Add column where you get data and parse JSON
let
tt=#table(
{"date"},{
{"2017-01-01"},
{"2017-01-02"},
{"2017-01-03"}
}),
add_col = Table.AddColumn(tt, "USD", each Json.Document(Web.Contents("http://example.com/?date="&[date]))[rate][USD])
in
add_col
If you need only one value
Json.Document(Web.Contents("http://example.com/?date="&YOUR_DATE_STRING))[rate][USD]

Resources