I'm new in MDX. I need to get the the row with MAX(Depth) in the following (Depth is a measure);
Username, Role, Category, Location and Form is dimensions. Name of the Fact table is AccessControl
Username Role Category Location Form Depth
John Creator Food NULL NULL 1
Rick Creator Food Washington NULL 2
The result I need to get is only Rick's row because it's depth is bigger then John;
Username Role Category Location Form Depth
Rick Creator Food Washington NULL 2
Thank you for your help !
You can use the TopCount function. With the TopCount you can use something like this:
SELECT [Measures].[Depth] ON 0,
TOPCOUNT([Access].MEMBERS, 1, [Measures].[Depth])
ON 1
FROM [AccessControl]
Related
I need to change the inventory category for a couple of account numbers and only for a couple of companies. The inventory category for these accounts are mapped based on the account number but need to be changed specifically just for two companies. I've tried to filter by the company number and then find/replace, which worked fine, but then I can't unfilter to bring back the rest of the companies. I can't change the category for just those account numbers because it is only different for just those two companies.
Lisa, Here's perhaps a simpler approach than where your current way is taking you.
If I begin with this table:
Then I add a column (Add Column -> Custom Column) with the following:
The formula uses an if statement to determine whether each row has a specific Account (Acct. 4) AND Company (Co. 8). If so, then 99 is returned as a new category value for that row of the new column. If not, then the original Inventory Category is returned as a value for that row of the new column. (Obviously, you would edit this formula accordingly, to support your account, company, and new inventory category values.)
Here's the result:
Then I could delete the original Inventory Category column and rename the remaining New Inventory Category column to Inventory Category.
I have a form in APEX that is used to add data into a table. Most of the items in the form are free form texts but there few items that are needed to auto filled when you enter a value in on of the page item.
For example.
There is form with Page Items. ID, Name, TitleLevel, Title_prefix, Salalry,
There is a table XYZ with Title_prefix and salary info which
ID Title_prefix Salaray
1 Junior 80000
2 Mid-Level 95000
3 Senior 115000
So you enter ID= 1, Name = ABCD, Titlelevel = 6 is entered and Title_prefix and salary should be populated based on the value that is entered in titlelevel. In this case it will be
Title_Prefix = (SELECT Title_Prefix FROM XYZ WHERE ID = (Case WHEN :P1_TitleLevel > 5 THEN 3 CASE WHEN :P1_TitleLevel = 5 THEN 2 ELSE 1 END))
Same thing for Salary as well.
Immediately after entering Titlelevel page item to 6 the Title_prefix and Salary should get refreshed and populate this items. Then the user will submit the form so that the information can be entered into the table.
Add a Dynamic Action on titlelevel (Key Release if Text Field, onChange if dropdown etc.)
Add a PL/SQL Action to the dynamic_action, using Items to Submit to pass fields in and Items to Return for the fields you modify.
Dynamic Action:
OR
Action:
I'm trying to do something which should be fairly trivial in Google Spreadsheet: I have a database of people in one sheet defined by "ID" and "Label" where the ID is a consecutive number and Label is the Name Surname of each person.
I'd need to be able, in a different sheet, to allow my team to type in the "Label" of a person and have the adjacent cell to show up the corresponding ID.
Given that sheet 1 is something like:
ID Label
01 Alice Johnson
02 Bert Junger
03 Carlos Lopez
I would like that in sheet 2 would happen something like:
person = raw_input()
if(person == exist in sheet 1):
get person's col and row from sheet 1
return value(person's col-1, person's row)
Ideally, I'm looking to do this only with google spreadsheets formulae, since it would be otherwise hard for my colleagues to be able to work on it.
Thank you so much everyone!
You could do this with an Index Match formula or V Lookup.. Have a look at this spreadsheet.
i have some problem when i created a calculated field in tableau.
lets say i have this "City" variable with these kind of data:
1
2
3
4
5
6
7
8
i want to make validate this number into if 1-4 become Region A, 5-8 become Region B and 1-8 is National.
this is my calculated filed code
if [City]=1 or [City]=2 or [City]=3 or [City]=4 THEN "Region A"
elseif [City]=5 or [City]=6 or [City]=7 or [City]=8 THEN "Region B"
elseif [City]=1 or [City]=2 or [City]=3 or [City]=4 or [City]=5 or [City]=6 or
[City]=7 or [City]=8 THEN "National"
END
but after i created this calculated field, only "Region A" and "Region B" and "Null" showed. My thought is maybe that code is overlapping on Region with National (or is not?).
How can i solve this? and where this null come from when my data only have the range from 1-8?
Thank you
edited :
Hi all, just want to confirm that the way i wanted it to look like is with 1 calculated field, when I clicked "Region A" it will show combination of city 1-4, when I clicked "Region B" it will show combination of city 5-6, and when i clicked "National" it will show combination of city 1-8.
Edit: After the clarification in the comments, what you need is a parameter. Create one that can take the values "Region A", "Region B" and "National".
Then create a calculated field with (I didn't use all city values to make it more readable):
CASE [parameter]:
WHEN "Region A" THEN IF [city] = 1 or [city] = 2 THEN [value] END
WHEN "Region B" THEN IF [city] = 3 or [city] = 4 THEN [value] END
WHEN "National" THEN [value] END
END
With the parameter you can now choose the grouping. For [value] you will need to insert the column you want to display (ie. Sales). If [city] has a value that is according to your criteria, it will populate the new calculated field with the value, if it is not, it will be empty, and if it is "National" then it will always use the value you defined.
Old Answer:
It sounds like you want to create a hierarchical structure to display your data on city, region and country level.
If that is the case you have a few options:
You have actual city names instead of 1, 2, 3 in your city column: Tableau will create the hirachy automatically if you define the column as a geographic role.
You have 1,2,3 but only one country: create one field Region with the formula you already have but leave the last ELSEIF out:
if [City]=1 or [City]=2 or [City]=3 or [City]=4 THEN "Region A"
elseif [City]=5 or [City]=6 or [City]=7 or [City]=8 THEN "Region B"
end
Then create a second calculated field Country and just give it the value 'National'
In your dimensions you can now create a hirachy by dragging and dropping th region and city field on top of the country field.
You have 1,2,3 and several countries: replace the value in the second calculated field with this formula and create the hirachy as in 2.:
if [City]=1 or [City]=2 or [City]=3 or [City]=4 or [City]=5 or [City]=6 or
[City]=7 or [City]=8 THEN "Country1"
elseif [City]=9 or [City]=10 or [City]=11 THEN "Country2"
END
A few further notes on that:
You probably want to use a CASE instead of that many IF, as it is easier to read and better to maintain
You might want to base it on the regions instead of the cities since you will only need to maintain eg 2 Regions for your original example versus 8 cities.
how can I set my own price in WooCommerce, based on product ID and numbers from added 2 input fields on my single-product/price.php ?
Here is example where i can target price :
http://pastebin.com/BZUV6csG#
But what about inputs? How can i achieve something like that:
if product_id= a or d or g
and inputWidth >=40 and <=60
and inputHeight >=60 and <=80
return product_price = my Value
I try many plugins already, but i have >100products
in different price cathegory based on id/product name) and with >150 price
variation based on width and height
Would you , please help me target those 2 inputs?
I added them using this plugin:
https://github.com/nextime/woocommerce-better-product-addons