Microdata for offering a boat charter with different prices according to the time of the year - microdata

Example page is: http://www.intercharter.com/IC/charter_card_en.php?sez=c&id=204
This page shows a boat and then a table with cabin charter rates and whole-boat charter rates, that vary according to the time of the year. I'd like to add schema.org microdata and I wonder how I should treat the rates table.
Should I create 2 Events for each row of the table (one for the cabin charter and one for whole-boat charter) and then an Offer nested in each event?
Or should I just create 2 Offers (and no Event) for each row and use availabilityStarts and availabilityEnd to describe the From/To dates of the pricelist?
In either case, should I nest the whole table in AggregateOffer?

Or should I just create 2 Offers (and no Event) for each row and use availabilityStarts and availabilityEnd to describe the From/To dates of the pricelist?
Yes, I think that would be (more) appropriate.
An alternative could be to have one Event per destination and nest all available Offers (via offers) under it:
Event: Yacht tour from xyz to Cyclades
offers → Offer: a cabin, available from 01/05/2014 to 31/05/2014, 970 EUR
offers → Offer: whole yacht, available from 01/05/2014 to 31/05/2014, 11140 EUR
offers → Offer: a cabin, available from 01/06/2014 to 30/06/2014, 1030 EUR
offers → Offer: whole yacht, available from 01/06/2014 to 30/06/2014, 13140 EUR
…
Event: Yacht tour from xyz to Sporades
offers → Offer: a cabin, available from 01/07/2014 to 31/08/2014, 1190 EUR
offers → Offer: whole yacht, available from 01/07/2014 to 31/08/2014, 15140 EUR
(might be tricky with table markup)
However, Schema.org defines that Event is for a specific event, "happening at a certain time and location". So using Event might not be appropriate here.
In either case, should I nest the whole table in AggregateOffer?
No. AggregateOffer is a more specific Offer (i.e., a sub-type), not a container for several Offers. So either use Offer or AggregateOffer.
AggregateOffer could make sense if you want to specify how many cabins/yachts are available/left (via offerCount) for each timeframe.

Related

Advanced Filter on PowerQuery

Question
I am trying to filter some excel data I have on PowerQuery but am really struggling to figure out the best way to do this. On Excel I would usually do this using an Advanced Filter but I don't believe Power Query has the same functionality.
I would like to filter across a number of columns, using an OR condition for a:
a range of values in some columns; and
a range of 'wild card' searches in other columns
Example
As an example if my dataset is as below
Name
Function
Sub-Function
Position
Country
Andy
Sales
Omni-Channel
Sales Manager
Brazil
Bob
Marketing
eCommerce
Web Design
Argentina
Rakesh
HR
Business Partnering
HRBP
Italy
Tom
Finance
Reporting
Finance Manager
UK
Chris
Sales
Trade Marketing
Sales support
US
Raj
Legal
Legal
Para-legal
Brazil
I might want to filter for anyone meeting the following criteria;
working in the sales function OR
working in the Trade Marketing or Omni-Channel sub-function OR
has the words 'Manager' or 'Sales' in their Position title OR
is based in Brazil
The desired output would then be
Name
Function
Sub-Function
Position
Country
Andy
Sales
Omni-Channel
Sales Manager
Brazil
Tom
Finance
Reporting
Finance Manager
UK
Chris
Sales
Trade Marketing
Sales support
US
Raj
Legal
Legal
Para-legal
Brazil
My current approach
My approach was to create a table which had all my criteria (not including the 'wild card' searches), upload to PowerQuery, create multiple lists from this table (called for example Filter1, Filter2 etc..). Then using the following formula against my main dataset
= Table.SelectRows(#"Filtered Rows1", each (List.Contains(Filter1,[Function]) = true) or (List.Contains(Filter2,[Sub-Function]) = true) or (List.Contains(Filter3,[Country]) = true) or Text.Contains([Position], "Manager") or Text.Contains([Position], "Sales"))
Issues
The formula above works for really small data sets however not on my 80,000 line data set, or rather it does not work within a reasonable time frame
I have a long list of 'wild card' searches which apply to three columns so typing in the Text.Contain(...... etc.. formula multiple times into the formula seems very inefficient, is prone to mistakes and is not dynamic in any way.
I'm sure there must be a better way to do this but I have not found many helpful discussions or tutorials on this online so am reaching out to the community.
Thank you
I think the part of the problem the query is slow as with your current approach, filtering is evaluating filtering conditions separately before it could filter. Power bi is capable of handling filter on multiple columns in a single filter, like following
Table.SelectRows(
#"Changed Type1",
each ([Function] = "Sales")
or ([#"Sub-Function"] = "Trade Marketing" or [#"Sub-Function"] = "Omni-Channel")
or (
Text.Contains([Position], "Manager")
or Text.Contains([Position], "Sales")
or ([Country] = "Brazil")
)
)

PBCS: Custom rules to aggregate Period members

I have an input account (never share) in which the user types a parameter for each month, I want that into aggregate members of Period dimension, for example on YearTotal, the value will be the weighted average between two other accounts representing the cost and the quantity.
With the account properties I can rollup my account in addition or as simple average between months, obviously in this way I get wrong data in both cases.
Anyone know a solution to my question?
Thanks a lot,
Daniele
Not sure exactly what you are asking. But I assume the following in my answer:
data entry for user on account Parameter (from the context, I think it is a price)
data entry for user on level0 Period, i.e. the months
you want Essbase to show the Parameter value as typed in at the month level (Jan .. Dec)
you want Essbase to show Costs / Quantity for Q1/2/3/4 and the YearTotal
the Account and Period dimension are of density: dense
You did not specify if you are also reporting on YTD values and how you have implemented this in Essbase. I assume you do, but the preferred solution depends on how you have implemented this, so I take the "safe" solution here:
solution 1
This is the most straightforward solution:
Implement a "parameter_inp" account on which the user keys in the data. Set the account to "never consolidate".
Create a new "parameter" account, dynamic calc, and give it the formula "Costs/Quantity;".
Refer to "parameter" in your reports, and to "parameter_inp" for user entry
solution 2 - alternative
If you have a lot of these parameters, you'll end up with a system making it unpleasant for data entry and reporting for the end-users. To solve it using data entry and reporting on the same "parameter" account, you need to tune your implementation for Quarter and YearTotal calculation, including the YTD calculation. I see no way of getting this correct if you are using DTS.
This is the way to go forward:
Make use of a new dimension called "View", data entry on PER (= periodic), additional dynamic calc member "YTD", density: dense, place it after Period (so Account, Period, View)
Add a UDA to the "parameter", for example "WA"
Set custom dynamic calculations on Quarter and YearTotal level, something like: IF (#ISUDA("WA")) THEN ELSIF <check on FLOW/BALANCE> ... logic for regular aggregation of FLOW and BALANCE items hereby overriding Essbase's native time logic)
Set custom dynamic calculations for YTD (overiding DTS), and make an exception for UDA "WA"

Columnar report in Tableau

I'm new to Tableau. I'm using Tableau Desktop Professional 10.0.15. I need to write a very simple report that does not use any visualization.
Here's a example of the layout (the numbers are made up):
Web Site 1 North America Europe
Total Hits 3,523,483 3,523,483
Sessions 1,248,234 1,248,234
Unique Visitors 1,809,392 1,809,392
New Visitors 383,932 383,932
% new 10.9% 10.9%
Avg Page Views per user 1.9 1.9
Web Site 2 North America Europe
Total Hits 3,523,483 3,523,483
Sessions 1,248,234 1,248,234
Unique Visitors 1,809,392 1,809,392
New Visitors 383,932 383,932
% new 10.9% 10.9%
Avg Page Views per user 1.9 1.9
The users want the measures to be in one column, but they're not the same measures. Some measures need to be formatted as percentages. The average should have 1 decimal place. I have a feeling it's not possible to format the same measure differently in Tableau. Ideally, there would be something like a banded report where I could stack the measures on top of each other. But, I don't see a way to do that in Tableau. I could create a table in my database and put the measures in the same field and add the formatting in the database (which feels wrong), but it would have to be text (to have '%'). But, Tableau won't treat a text field as a measure. Also, it seems like if you don't add a measure, Tableau will insert a fake measure and put 'Abc' as the value (at least, I think that's why I'm getting these 'Abc' columns in my reports that I didn't add and that aren't in my data).
It seems like Tableau wants you to do something like this:
Unfortunately, this is not what my users want. Any suggestions?
In Tableau it's possible to put many measures in a single column using the measure names in rows.
To do this, add to filters shelf the dimension called Measures Names (the last one). Select all the Measures you'd like to show (Hits, Sessions, Visitors, Views, etc.). Then, drag this dimension to the rows shelft. Next, drag the measure called Measures Values (the last one too) to the marks shelf, specifically in the text box. You can also add other dimension to rows shelft (like website) to the left of Measures Names. This will show a table similar to your requirement.
By default, the Measure Values are SUM of each measure. Just right click on them and select the aggregation you need (AVG, COUNT or other).
Finally, you can format each measure as you want, right click a measure value, and select Format...

Complex "featured product" model using query-time ranking (optional filters)

I have a products index that displays filtered results on category pages.
For a given category, any amount of products may be flagged as featured, meaning it displays first.
When products are displayed for a category, only one featured product should show at a time (at random from the available products flagged as featured)
Additionally, a product should not be flagged as featured if it has date range fields and the current date is not within the range
So, my index might look something like: https://gist.github.com/1a0327d8a321dc6627e197b94f4209c9
A solution to 1. has been posted here: https://stackoverflow.com/a/40922535 using optional filters, currently in private beta: https://www.algolia.com/doc/advanced/optional-filters-scoring/. At query time I could do optionalFacetFilters: ["featuredIn.category:category1"] Update: I've since been told by Algolia reps that this feature is has a large performance cost, and therefor is only really viable for enterprise customers.
However, I'm at a loss as to how to pull of 2. and 3..
Any guidance is greatly appreciated!

I need an XPATH to extract data from www.gsmarena.com

I am doing a research about how mobile phones evolved over years so I need to create a database with specifications of as many phones is possible. I am trying to scrap data from GSM Arena website.
Example page: http://www.gsmarena.com/samsung_galaxy_note7-8082.php
I am using XPATH that contains the label that precedes each value, example //tr[contains (.,"Sensors")]/td[2]
But there are some values, last one in category, with no preceding label.
How do I pick this info:
Non-removable Li-Po 3500 mAh battery
or this ino:
Fast battery charging
Qi wireless charging (market dependent)
ANT+ support
S-Voice natural language commands and dictation
MP4/DivX/XviD/WMV/H.265 player
MP3/WAV/WMA/eAAC+/FLAC player
Photo/video editor
Document editor
Do note that different phones have different number of rows on page, so using [number] in XPATH would pick different info from
http://www.gsmarena.com/samsung_galaxy_note7-8082.php - need to pick 5th row of features
http://www.gsmarena.com/samsung_sgh_600-49.php - need to pick 8th row of features
To select rows without label in Battery section you have to use this xpath:
//tbody[.//th[contains(.,'Battery')]]//td[#class="ttl" and not(*)]/following-sibling::td
To select info from features use this
//tbody[.//th[contains(.,'Features')]]//td[#class="ttl" and not(*)]/following-sibling::td
To select Camera features
//tbody[.//th[contains(.,'Camera')]]//td[#class="ttl" and contains(.,'Features')]/following-sibling::td
To select Loudspeaker in Sound Category
//tbody[.//th[contains(.,'Sound')]]//td[#class="ttl" and contains(.,'Loudspeaker')]/following-sibling::td

Resources