Interactive switching of value fields in Quicksight Visuals - amazon-quicksight

I'm sure this is a pretty noob question, but I am stuck. I have found a tutorial on how to use parameters to set switch between fields here: https://www.youtube.com/watch?app=desktop&v=Dk9NtZbH2Hw I was wondering if there is a way to do this with value fields, like say on a heat map visual, to be able to switch between revenue and cost via dropdown? I can not get a ifelse formula to work with these types for fields. Thank you in advance!

I dont't know much about the specifics of your data or the error, but similar to the video, you could create a parameter with manual values "Revenue" and "Cost" and set that as the dropdown control on the plot, then create a calculated field:
ifelse(${parameter} = "Revenue", {revenueFieldName}, ${parameter} = "Cost", {costFieldName}, "Some Default")
Then in the heatmap value field, use this new calculated field instead, and it should toggle based on the parameter.

Related

Setting parameter controls and using filters

I currently have a dataset of speeding fines in NSW.
I've created a bar chart that displays the top 10 frequencies of speeding offenses. These offenses are split up between school zone offenses and normal speeding offenses.
I'm trying to set a parameter control where the end-user can toggle showing the top 10 normal speeding offenses (pink), top 10 school zone offenses (purple) or both together (pink and purple).
I've gotten the below parameter control:
However nothing happens to the bar-chart.
My Dataset looks like the following:
I have a School Zone Indicator boolean that is a Y if the speeding offense occurred during school zone time.
Can someone help me figure out in filtering this out when setting parameter controls?
The answer is based on this article showing how to add all to a parameter in Tableau.
We need to create a parameter with the same values as the field. As your field is either Y or Null let's create a new field to convert the Null to N. Call it isSchool with the formula:
IFNULL([SCHOOL_ZONE_IND],"N")
Create a parameter based on that field with the values Y, N and All. Display As whatever you want, so you can display parameter value All as Show Both if you wish.
Put [isSchool] to filters.
In the filter you want to filter Condition - by Formula. Enter this formula:
IFNULL([isSchool],"1")=IF [YourParam]!="All" THEN [YourParam] ELSE IFNULL([isSchool],"1") END
That should do it.

Is it possible to have a constant value in a calculated field in QuickSight?

In QuickSight, when you want to define a constant value to reuse it in visualizations later, you can try to set it as:
Calculated field: goalFor2020
Formula: 20000
But right now it doesn't allow you to put just a number in the formula.
Is there any way to do achieve having just a number in the formula of a calculated field?
The reason we need it is just to have a number that doesn't depend on any data, just manually defined by us.
Interesting, QuickSight lets me insert a number into a calculated field, just fine.
Since that isn't working for you, I'd recommend using a parameter with a default value. For example,
Parameters essentially has the same "rights" as a calculated field (it can be used in visuals, other calculated fields, etc...). It can also be passed via query parameters which may or may not be a feature that you'd find useful.
Another cool benefit of using parameters is that, if you're embedding QuickSight, you could retrieve this value dynamically and pass it to the dashboard. Then if you wanted to, say, generalize your for different yearly goals, the goal could be passed and dynamic (rather than hard-coded in a calculated field).
We could achieve it with a trick, just apply some function that returns a number to one of your columns, and make it 0, then add your constant number:
Calculated field: goalFor2020
Formula: count(email) * 0 + 20000
It does the trick, but there might be a better way to do it.
I have tried something like this:
distinct_countIf({dimension},{dimension}='xxx')*
+distinct_countIf({dimension},{dimension}='xxx')*
just makes the discount_countif meet the requirement, so it will return to 1. And use 1* the number you want to hardcode. If the requirement does not meet, it will return 0 so it won't add up the number

Can a PowerApps gallery be sorted from a derived column?

I have a PowerApps gallery that lists data from 3 different tables and have it normally sorted by the following:
SortByColumns(Filter(Personnel, !Dismissed, txtMSSearchBox.Text in MemberName), "MemberName", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
One of the fields is displayed from the below:
Last(SortByColumns(Filter(PersonnelEvents, MemberNumber.Id = ThisItem.ID, EventType.Value="Promotion"), "Date", SortOrder.Ascending)).Title
What I would like to do is sort the gallery by this derived data. Is this even possible?
Can you try making On visible of the screen have an UpdateContext function which saves this formula as a variable.
You can then reference this variable as the column you want to sort by.
i.e something like UpdateContext({mySortColumn: Last(SortByColumns(Filter(PersonnelEvents, MemberNumber.Id = ThisItem.ID, EventType.Value="Promotion"), "Date", SortOrder.Ascending)).Title})
I just hope I really understand what you are trying to achieve, but if this doesn't work, maybe you can explain better what you are trying to do and hopefully I'll be able to help
I have decided to use Flow to update a column in my main table to show the relevant data and thereby sort by that field. I believe this would be an easier way to accomplish what I want.

Extract a column from crossfilter

Heres my problem. I have a working dc.js based dashboard and some data within it. A column of the data contains text data (twitter info). Is it somehow possible to extract that specific column from crossfilter? My aim is to create some charts and the crossfilter containing the text data should feed into a d3 based word cloud so that i can do the drill down based filtering as well which dc and crossfilter provide out of the box. I tried a dimension.top(infinity) but that returns all the key value pairs in the data. I just need the values for a particular key across the whole data set. I hope my question makes some sense.
EDIT:
More research reveals that the wordcloud will accept data in key value pair where the key is the word and value is its frequency of appearance. So i am guessing that will need to be implemented as well. If there is a ready to implement library out there kindly let me know as well. This changes things a bit as far as crossfilter is concerned.I need to throw this calculated key value pair (fit for the word cloud consumption) whenever a filter is triggered. How to go about it?
Looking forward to hearing from you all.
Best,
Anmol
Answer to the first part of the question: Probably dimension.top(Infinity) and then use an accessor to get the values you need. Not exactly efficient, but it is what it is.
Answer to the 2nd part of the question:
You need groupAll, I think. You want to take a tweet, generate an array of tokens (words), then generate a Crossfilter grouping that is a count per word, right? You can code your own custom crossfilter.dimension.groupAll reducers (if you want to do that, create a working example and I can probably cook it up). Or if you want to use Reductio:
tweetWords = data.dimension(function(d) { return d.tweetText.split(' '); });
wordCounts = tweetWords.groupAll();
reducer = reductio()
.groupAll(function(d) {
return d.tweetText.split(' ');
})
.count(true);
reducer(wordCounts);
wordCounts.all();
If you want to filter on this dimension you'll have to override the filter handler and check if the group key is in the dimension array for the record using a filterFunction.

Add map rule to predefined data style (refer to "value of this data item")

in our reporting the value of data elements will be rewrited with "-" in the case of Null.
Can I put this mapping rule to the predefined style of the "data" element ? I tried it, but I don't know who to implement the later reference to "The_current_row_value". Has anyone a idea?
Thanks a lot.
Instead of trying to use an edit tool in the report, use SQL's isnull() to convert null values to whatever value you desire.
ISNULL (Transact-SQL)
If for some reason that does not appeal to you, use a computed column in your BIRT data set, and define the value with Java Script.

Resources