Write a calculated field formula in AWS QuickSight using ifelse - amazon-quicksight

I am trying to create a waterfall chart in quicksight with the below dataset format.
I want to multiply the values of specific metrics, for instance if Type = Metric 1 and Metric2, then multiply their respective values, is that feasible using the calculated field option? thanks
**Type | Value**
Metric 1 | 10
Metric 2 | 20
Metric 3 | 30

Related

max() Aggregation in Kibana

I'm creating a dashboard in Kibana with an index.
Date | Place | Value
------|-------|-------
12/16|LUXURY | 5
12/16|LUXURY | 3
12/16|LUXURY | 5
12/16|LUXURY | 6
from the above records, I want to fetch only the record with maximum value (6).
simply, the logic should be max(Value for Date,Place) in many languages but I'm not sure about Kibana. Please help me to create a column (new scripted field) for my visualization.
Thanks

Throughput Volume Query in Application Insights

i am trying to get Throughput(Volume) metrics by using below query
requests
// additional filters can be applied here
| where timestamp > ago(24h)
| where client_Type != "Browser"
| summarize count() by bin(timestamp, 5m)
| extend request='Volume'
// render result in a chart
| render timechart
So my question is for Volume do we use Count() or sum(itemCount) ? Which one of these is more Accurate to get Volume(Throughput) details per interval ??
The right way is to use sum(itemCount). Then this metric will be correct for sampled applications (by default adaptive sampling will kick in when number of telemetry items exceeds 5/sec).

MDX : calculate maximum value per dimension member

Good morning. i have the following fact table
FK_Cmd |FK_Ship |Dilevry_time
C001 |1 |20
C001 |2 |25
C002 |1 |23
i want to calculate the average maximum delivry time per Cmd which would be (25+23)/2 = 24 in the exemple.
i am using the following MDX request :
AVG(MAX([Dim Cmd].[PR_Cmd],[Measures].[Delivery time]))
but i don't get any correct result. can you help with this ? thanks
You would need to define it as a member something like:
WITH MEMBER [Measures].[Max Delivery time] AS Max
([Dim Cmd].[PR_Cmd].currentMember
, [Measures].Delivery time]
)
MEMBER [Measures].[Avg Max Delivery time] AS Avg
([Dim Cmd].[PR_Cmd].allMembers
, [Measures].[Max Delivery time]
)
SELECT [Measures].[Avg Max Delivery time] ON 0
FROM [Cube]
I don't have SSAS currently so I cannot test it but it should be something similar. Another way would be to define it as calculated member in your cube definition if that's important metric for you instead of using MDX every time. It would be faster in the end because the cube will have that value ready for you.

SSRS Reporting - count number of group rows

I am trying to the count of number of groups in my report I know I could do it in the SQL however trying to avoid adding redundant data to my dataset if I can.
I have a MainDataSet that could have multiple entries per distinct group item. All I want is the no. of groups not the count of items within the group.
For example words starting with alphabet letters, lets say I have 2 groups A and B only (NB: number of groups can change dynamically as I filter the MainDataSet based on user parameter selection):
Group | Data
------|-----
A | Apple
A | Ant
B | Balloon
B | Book
B | Bowl
Final Result:
Group | Index | NGroups
A | 1 | 2
B | 2 | 2
I know I can get the Index using a aggregate function as follows:
RunningValue(Fields!Group.Value, CountDistinct, "TablixName")
But how do I get the NGroups value?
I guess I could also create another dataset based on the MainDataSet (make use of a sql function) and do:
SELECT 'X' AS GroupCount, COUNT(Distinct Group) AS NGroups
FROM dbo.udf_MainDataSet()
WHERE FieldX = #Parameter1
Then use a LookUp:
Lookup("X", Fields!GroupCount.Value, Fields!NGroups.Value, "NewDataSet")
But is there a simple solution that I am not seeing?
CountDistinct(Fields!Group.Value, "TablixName")

Spotfire: Using one selection as a range for another datatable

I've searched quite a bit for this and can't find a good solution anywhere to what seems to me like a normal problem for this product.
I've got a data table (in memory) that is from a rollup table(call it 'Ranges'). Basically like so:
id | name | f1 | f2 | totals
0 | Channel1 | 450 | 680 | 51
1 | Channel2 | 890 | 990 | 220
...and so on
Which creates a bar chart with Name on the X and Totals on the Y.
I have another table that is an external link to a large (500M+ rows) table. That table (call it 'Actuals') has a column ('Fc') that can fit inside the F1 and F2 values of Ranges.
I need a way for Spotfire Analyst (v7.x) to use the selection of the the bar chart for Ranges to trigger this select statement:
SELECT * FROM Actuals WHERE Actuals.Fc between [Ranges].[F1] AND [Ranges].[F2]
But there aren't any relationships (Foreign keys) between the two data sources, one is in memory (Ranges) and the other is dynamic loaded.
TLDR: How do I use the selected rows from one visualization as a filter expression for another visualization's data?
My choice for the workaround:
Add a button which says 'Load Selected Data'
This will run the following code, which will store the values of F1 and F2 in a Document Property, which you can then use to filter your Dynamically Loaded table and trigger a refresh (either with the refresh code or by setting it to load automatically).
rowIndexSet=Document.ActiveMarkingSelectionReference.GetSelection(Document.Data.Tables["IL_Ranges"]).AsIndexSet()
if rowIndexSet.IsEmpty != True:
Document.Properties["udF1"] = Document.Data.Tables["IL_Ranges"].Columns["F1"].RowValues.GetFormattedValue(rowIndexSet.First)
Document.Properties["udF2"] = Document.Data.Tables["IL_Ranges"].Columns["F2"].RowValues.GetFormattedValue(rowIndexSet.First)
if Document.Data.Tables.Contains("IL_Actuals")==True:
myTable=Document.Data.Tables["IL_Actuals"]
if myTable.IsRefreshable and myTable.NeedsRefresh:
myTable.Refresh()
This is currently operating on the assumption that you will not allow your user to view multiple ranges at a time, and simply shows the first one selected.
If you DO want to allow them to view multiple ranges, you can run a cursor through your IL_Ranges table to either get the Min and Max for each value, and limit the Actuals between the min and max, or you can create a string that will essentially say 'Fc between 450 and 680 or Fc between 890 and 990', pass that through to a stored procedure as a string, which will execute the quasi-dynamic statement, and grab the resulting dataset.

Resources