Tableau dashboard filter body-text display - filter

I have week filter in my tableau dashboard, but the body of it has just numbers 1, 2, 3.. displayed. How can I have them displayed as
Week 1
Week 2
Week 3 and so on.

You can make a calculated field, call it "Week Filter" and in the body of the calculation type: "Week " + STR([Week]), and use this new field as a filter.

Related

How to setup a control with month names

In my db i have a column created_at (date_time format). I would like to create an analytical dashboard when it will be possible to filter data by create_at by giving month name (one or more - multiple choice)
I have added a new calculated field "month" in data set with following formula:
formatDate(truncDate("MM",{created_at}),"MM" )
As a result i get new column with strings like "01", "02" etc.
I've created a new parameter:
name: Month
Data type: string
Values: multiple values: {01, 02, 03 ....}
I've created a new control:
name: Month
Style: Multi select drop down
Values: Link to a data set field -> Data set -> Month column
I've created a new filter for Month columns, based on Month parameter
My problem is: how to achieve the same result (filtering by month, multi select) having month names displayed in the control, not "01", "02" etc. Is it possible?
UPDATE
It is much better to have following formula in Month calculated field:
extract("MM",{create_at})
But it does not solve my problem....
What i did, but i really don't like this solution as it is so ugly.....Any better solution is welcome :)
new calculated field month_number, with formula:
extract("MM",{create_at})
new calculated field month_name with formula:
ifelse({Month_number}=1,"Jan",ifelse({Month_number}=2,"Feb",ifelse({Month_number}=3, "Mar",ifelse({Month_number}=4, "Apr",ifelse({Month_number}=5, "May",ifelse({Month_number}=6, "Jun",ifelse({Month_number}=7, "Jul",ifelse({Month_number}=8, "Aug",ifelse({Month_number}=9, "Sep",ifelse({Month_number}=10, "Oct",ifelse({Month_number}=11, "Nov",ifelse({Month_number}=12, "Dec","Error"))))))))))))

Show Different category name in tooltip in spotfire bar chart

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.

DAX Syntax - if versus switch

Need help with the correct syntax. I need to determine based on 3 columns (Year, Years of Service, Terminate) if the years of service fall between the following criteria or the Terminate column has a date.
IF(["#YearsofService"]=>2,"2+ Years" else "Less than 2 Years") else Terminate(has a date) is not null. This will be for an new column displaying the criteria text.
also tried Switch function.
=SWITCH(TRUE()
[#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
isblank([Term Date]), "Termed"
)
also tried:
IF(ISBLANK([Term Date])=false, "Termed",IF([#"#YearsofService"] >=2,"2 + Years","Less Than 2 Years"))
but does not like the If portion of statement
I think SWITCH TRUE would be the best solution for this sort of multi-test requirement. The sequence of tests after the TRUE is critical - DAX will stop evaluating after the first TRUE result is struck. So here's my attempt:
=SWITCH(TRUE()
, NOT(ISBLANK([Term Date])), "Termed"
, [#YearsofService] >=2,"2 + Years"
, [#YearsofService] <2, "Less Than 2 Years"
)
In your example you are only using two of the mentioned columns (Years of Service and Terminate). I guess the statement should look like this:
Result = IF(ISBLANK([Term Date]);IF([#"#YearsofService"]<2;"Less than 2 years";"More than 2 years");"Termed")

Qlikview, how to create an expression which does not change with listbox selection?

Example, I have table below..
Week, Quantity
1, 10
1, 15
1, 10
2, 20
2, 30
3, 10
3, 50
I also have a list box for 'Week' which is current selected on week 2.
Now, I want to create text object which shows the value of sum of quantity of week 1 (ie. 35), which will always show that result even when the list box is selected on week 2. How can I achieve this?
Currently I managed to do an expression which sums week 1 but as soon as I select week 2 it shows 0 ....
Enter the following to your textfield:
= 'Sum week 1 : ' & sum({$<Week={'1'}>}Quantity)
Use the '&' to concat values. And use the set analysis (Page 799 of the QlikView Reference Manual) to select the reqired values.
sum({$<Week={'1'}>}Quantity)
Read this like: Sum the values of 'Quantity' Where 'Week' is 1.
Replace the '$' with '1' and the expression will ignore current selection
e.g.
sum({1<Week={'1'}>}Quantity)
do this:
sum({<Week={'1'}>}Quantity)
That is basically telling Qlikview regardless of what is selected in Qlikview, that expression will always calculate as if Week 1 is selected.

Google Analytics API "ga:day" dimension and more than 1 month of data returns aggregate instead of absolute values

I am attempting to retrieve Google Analytics daily visitor counts. I'm following this blog post.
For under 30 days of consecutive data, everything works great. The problem is that the result rows get "grouped together." Consider this query:
{ ids: 'ga:44339606',
'start-date': '2013-01-01',
'end-date': '2013-02-14',
dimensions: 'ga:day',
metrics: 'ga:visits',
segment: 'gaid::-1' }
The values returned for days 01 -14 are incorrect, because they actually represent the sum of January 1st + February 1st, and the sum of January 2nd and February 2nd, and so on. In other words: there is only one entry returned for each day of the month, 1-30, instead of returning 44 entries.
How can I adjust for this, without breaking the query into multiple calls?
Turns out, I wanted the ga:date dimension instead of ga:day
Check out the playground; it's great for figuring out params: https://ga-dev-tools.appspot.com/explorer/

Resources