Wiki Markup |
---|
{anchor:top} {toc: class=contents} h2. Overview概要 {styleclass: Class=topLink}[topページトップ|#top]{styleclass} Subサブクエリーの使用で、さらに高度なレポートを作成することができます。現営業年度と過去の営業年度との売上結果を比較する場合に追加クエリーを使用したり、ある特定の年度で新規顧客はどれかを特定する場合にマイナスクエリーを使用したりすることがあります。このような例では、Yellowfinでは異なる2種類のクエリーを作成して、結果のセットを結合した1つの表にして表示します。Yellowfinでは、以下の4タイプのサブクエリーを作成することができます: queries permit as user to generate far more sophisticated reports. For example if you wanted to compare the sales results of this financial year with past years you may wish to use an append query or if you wanted to determine which customers were new in a particular year you would use a minus query. In both these examples Yellowfin is generating two distinct queries and then combining the result set to provide you with a single table of results. With Yellowfin you can create 4 types of sub query, these are: | | !sbqry_append.png! | *Append追加*|The append\\ sub| query追加サブクエリーは1つのクエリーの結果を取り込み、その結果を追加のカラムとして、もう1つの結果セットに追加します。このクエリーの目的は、1つのクエリーの結果を別のクエリーの結果と比較することです。 takes the results of one query and appends them to another set of results as additional columns. The purpose of this query is to allow the result of one query to be compared to that of another.| |\\ | | !sbqry_union.png! | *Union結合*|The union\\ sub| query結合サブクエリーは、2つのクエリーの結果を結合して、対応するカラム(列)から成る1つの表にします。結合は、表が完全には標準化されていないときのデータウェアハウスのアプリケーションで役立ちます。 combines the results of two queries into a single table of matching columns. Unions can be useful in a data warehouse application when tables aren't perfectly normalised.| |\\ | | !sbqry_minus.png! | *Minusマイナス*|The minus\\ sub| queryマイナスサブクエリーは、1つのクエリーにおいて個々のロウ(行)を取り込み、2番目のクエリーに出現しない行を返します。 takes distinct rows of one query and returns the rows that don't appear in the second query.| |\\ | | !sbqry_intersect.png! | *Intersect交差*|The intersect\\ query| takes the results of two queries and returns only the rows that appear in both sets.交差クエリーは2つのクエリーの結果を取り込み、どちらのセットにも出現するロウ(行)だけを返します。 \\ | h3. Enablingサブクエリーの有効化 Sub Queries # To create a new sub query tick the sub query check box in the analysis section of the report options menu. This will provide a + Sub Query Menu link at the top of the report data section. # 新しいサブクエリーを作成するには、レポートのオプションメニューにある分析セクションのサブクエリーチェックボックスをオンにします。これによって、レポートデータセクションの最上部に「\+ サブクエリー」メニューのリンクが表示されます。 !01enableSubQuery.png! # Choose the query type you wish to create. On selection a new tab will be displayed (Sub Query). This will enable you to create your new sub query. 作成するクエリーのタイプを選択します。選択によって新しいタブが表示されます(サブクエリー)。これで、新しいサブクエリーを作成することができます。 !02createSubQuery.png|thumbnail,border=1! h3. Subサブクエリーとマスタークエリーの関連 Query Relation to Master Query When creating a sub query the data that is returned needs to be related to the initial or Master query. The sub query cannot run independent of the master query. So the implications is that for each type of sub query different join rules exist to link the sub queries results sets with those of the master query. h3. Changing the Sub Query tab display name Initially the display name of a sub query is "Sub Query" . However by clicking to the report options menu for the sub query you can change the display name to something more meaningful if required. サブクエリーの作成時に、返されたデータをイニシャルクエリーまたはマスタークエリーに関連させる必要があります。サブクエリーは、マスタークエリーに関連させていない状態では実行できません。サブクエリーのタイプ別に関連があるため、サブクエリーの結果セットとそのマスタークエリーを結合するためのルールがあり、その結合ルールがそれぞれ異なります。 h3. サブクエリータブの表示名の変更 サブクエリーの初期の表示名は「サブクエリー」です。ただし必要に応じて、サブクエリーのレポートオプションメニューをクリックして、表示名をより意味のあるものに変更することができます。 !03renameSubQuery.png|thumbnail,border=1! h2. Append Queries追加クエリー {styleclass: Class=topLink}[topページトップ|#top]{styleclass} The追加サブクエリーは1つのクエリーの結果を取り込み、その結果をデータの新規カラム(列)として、もう1つのクエリーに追加します。1番目のクエリーと2番目のクエリーは、この2つのクエリーを結合させるため、まったく同じGROUP appendBY(またはディメンション(次元))のカラム(列)がなければなりません。 sub query takes the results of one query and appends these to another as new columns of data. The two queries must have exactly the same GROUP BY (or Dimensional) columns in order to join them. The purpose of the append query is to allow the result of one query to be compared with another. For example you may want to compare the YTD revenue for the current year with the revenue for the same period for last year. Typically this is difficult to do unless the data source has been configured to allow this by having a column for each of these attributes. Generally though the data will be stored a separate rows in the same table. With the append query, 1 query will retrieve the current period's results whilst the other will retrieve the previous periods result. Using calculated fields it is now possible to compare the results. 追加クエリーの目的は、1つのクエリーの結果を別のクエリーの結果と比較することです。当年のYTD(会計年度の初めから現在まで)の収益と昨年の同一期間の収益を比較する場合、この比較ができるようにデータソースの設定を当年と昨年のYTDの属性のそれぞれに対するカラム(列)が存在するよう設定していない限り、通常は比較しにくいものです。通常、データの格納場所は同じ表の中でもロウ(行)が違います。追加クエリーによって、1番目のクエリーが当年のYTDの結果を取り込み、別のクエリーが昨年の期間の結果を取り込みます。計算フィールドを使用することで、この2つのYTDの結果を比較することができます。 !append.png! h3. Example例 Comparing in国別に年間収益を比較する。 revenue in one year compared to another by country. # Firstly最初に1つのクエリーを作成する必要があります。このクエリーは、国別に選択された期間の収益を返します。カラム(列)フィールドに「Camp you will need to create a query that returns the revenue for a selected period by country. Country, Sum Invoiced Amount and Year in the filter # Now select the sub query option and choose append. You will see a very similar query builder to the standard builder. In the fields section you will have to replicate the attributes of your original query so that the same level of aggregation can occur. # The join will have to be specified for the sub query. In the join section click the refresh link to display the available join fields. You will have to link the fields on the master query with the fields on the sub query. {color:#C00000}*Note:*{color} you do not have to include metric fields. # Once you have matched the fields click the add icon to add the join to the list. # Now return to your master query. You should see additional attributes in the fields list. Note they are prefixed by sub query: and cannot be removed from the list of fields. # The final step is to set the filters. Progress to the filters page. You will see that similar to the data page you have a tabbed set of filter attributes. Set the filter value for each filter for the specific periods required. # When you now run the report you will have two columns one for each period specified. If required you can also created calculated fields to determine the difference between the two values. This would be done on the master query by creating calculated fields in the standard way. bq. See [Append Sub Query TutorialCountry」と「Invoiced Amount」の合計、フィルターに「Year」があります。 # サブクエリーオプションを選択して、追加を選択します。標準的なビルダーとよく似たクエリービルダーが表示されます。フィールドのセクションで、オリジナルのクエリーの属性を再現する必要があります。オリジナルのクエリーの再現によって同一レベルの集約が行えるようになります。 # サブクエリーに対する結合を設定する必要があります。結合セクションで、「更新」をクリックして利用可能な結合フィールドを表示します。マスタークエリーのフィールドとサブクエリーのフィールドをリンクさせる必要があります。 {color:#c00000}{*}注意:*{color}メトリック(数値)フィールドを含める必要はありません。 # フィールドを対応させたら、「追加」をクリックして結合を一覧に追加します。 # マスタークエリーに戻ります。フィールドの一覧に、追加の属性が表示されます。この属性はサブクエリーによって接頭辞として付けられていることと、フィールドの一覧から削除できないことに注意してください。 # 最後のステップはフィルターの設定です。フィルターのページに進みます。このページは、データページと同じようにフィルター属性のタブ型セットになっています。それぞれのフィルターに要求される期間のフィルター値を設定します。 # この段階でレポートを実行すると、設定済みの各期間に1つずつ、合計2つのカラム(列)ができます。必要に応じて、計算フィールドを作成し、この2つのカラム(列)の値の違いを測定することができます。これは、マスタークエリーに通常の方法で計算フィールドを作成して行います。 bq. 詳細については、[サブクエリーの追加のチュートリアル|Tutorial - Append Sub Queries] for more information. を参照してください。 h2. Union結合クエリー Queries {styleclass: Class=topLink}[topページトップ|#top]{styleclass} A結合クエリーは、2つのSQLクエリーの結果を結合して、対応するロウ(行)をすべて含んだ1つの表にします。この2つのクエリーには、結合させるために同一数のカラム(列)と互換性のあるデータタイプが必要です。重複レコードは、「UNION UnionALL」を設定しない限り、自動的に削除されます。 query combines the results of two SQL queries into a single table of all matching rows. The two queries must have the same number of columns and compatible data types in order to join them. Any duplicate records are automatically removed unless UNION ALL is used. Union can be useful in data warehouse applications where tables aren't perfectly normalised. For example a table may have revenue in separate columns for individual products rather than revenue by product code. A union join would allow reporting to change display from: 結合は、表が完全には標準化されていないデータウェアハウスのアプリケーションで役立ちます。たとえば、製品コードごとの収益ではなく、製品ごとに別のカラム(列)に収益がある場合です。結合クエリーによる結合で、次のレポートの表示形式を変更することができます。 !union.png! h3. Examples例 Display invoiced amount and cost amount on separate lines rather than separate columns. # Create a calculated field for a label = Invoiced # Create a query that returns the revenue by country. Country, Label and Sum Invoiced Amount # Now select the sub query option and choose Union. With the union query you will need to match fields from the first query with those in the second. In this case a new calculated field is created for the "Cost Label" and added into the report. Instead of the metric invoiced amount the new metric of cost of camp is added. # When you now run the report you will have a single column for both received and invoiced amounts. bq. See [Union Sub Query Tutorial 請求金額とコスト金額のそれぞれを、別々のカラム(列)ではなく、別々のロウ(列)に表示します。 # ラベルの計算フィールドに「請求」と入力します。 # 国別の収益を返すクエリーを作成します。カラム(列)フィールドに、「Camp Country」、「Label」、「Invoiced Amount」の合計が表示されます。 # サブクエリーオプションを選択して、「結合」を選択します。結合クエリーで、最初のクエリーのフィールドと2番目のクエリーのフィールドを対応づける必要があります。この場合、「コストラベル」に対して新しい集計フィールドが作成され、レポートに追加されます。 メトリック(数値)の請求金額ではなく、キャンプコストの新しいメトリック(数値)が追加されます。 # この段階でレポートを実行すると、領収金額と請求金額の両方に対して1つのカラムが表示されます。 bq. 詳細については、[結合サブクエリーのチュートリアル|Tutorial - Union Sub Queries] for more information. を参照してください。 h3. Union Allすべて結合 With a standard union join duplicate records are not returned so if the row in the sub query matches the row in the master query it will not be displayed, If you wish to display duplicate records you must specify this at the sub query level. h2. Intersect Queries 通常の結合では重複レコードは返されません。このため、サブクエリーのロウ(行)がマスタークエリーのロウ(行)と一致していても表示されません。重複レコードを表示する場合は、サブクエリーレベルで「重複レコードを表示」を指定する必要があります。 h2. 交差クエリー {styleclass: Class=topLink}[topページトップ|#top]{styleclass} An Intersect query takes the results of two queries and returns only rows that appear in both result sets. For example if you wanted to know which customers purchased services in Year 1 *as well as* Year 2 then an intersect query is needed. 交差クエリーは2つのクエリーの結果を取り込み、どちらの結果セットにも出現するロウ(行)だけを返します。たとえば、どの顧客が年1{*}および{*}年2にサービスを購入したかを知る場合には交差クエリーが必要になります。 !intersect.png! h3. Example Determine例 which customers purchased services in Year 1 *as well as* Year 2. # Firstly you will need to create a query that returns a list of customers that took part in Year 2. Athlete ID, First Name, Last Name and Year in the filter. {color:#C00000}*Note:*{color} some of these may not have purchased in Year 1. # Now select the sub query option and choose Intersect. You will see a slightly different interface to the normal query builder. The purpose of this is to select a linked field or key in the master query and determine which filters you which to apply. In this example we want to link on the athlete id and filter it by year 1. # The final step is to set the filters. Progress to the filters page. You will see that similar to the data page you have a tabbed set of filter attributes. Set the filter value for each filter for the specific periods required. bq. See [Intersect Sub Query Tutorial どの顧客が年1{*}および{*}年2にサービスを購入したかを特定する。 # 年2に属している顧客の一覧を返すクエリーを作成する必要があります。以下の図のように、カラム(列)フィールドに「アスリートID」、「名」、「姓」、フィルターに「年」を加えます。 {color:#c00000}{*}注意:*{color}この中には年1に購入していない顧客が含まれている可能性があります。 # サブクエリーオプションを選択して、交差を選択します。通常のクエリービルダーとは少し違うインターフェースが表示されます。この目的は、マスタークエリーへリンクするフィールドまたはキーを選択して、適用するフィルターを指定することです。この例では、アスリートIDとフィルターをリンクし、年1の値を設定します。 # 最後のステップはフィルターの設定です。フィルターのページに進みます。このページは、データページと同じようにフィルター属性のタブ型セットになっています。それぞれのフィルターに要求される期間のフィルター値を設定します。 bq. 詳細については、[交差サブクエリーのチュートリアル|Tutorial - Intersect Sub Queries] for more information. を参照してください。 h2. Minusマイナスクエリー Queries {styleclass: Class=topLink}[topページトップ|#top]{styleclass} A Minus query takes the distinct rows of one query and returns the rows that do not appear in a second result set. A minus query is almost the opposite of the intersect query, rather than displaying data in common the minus subtracts data from the result set. マイナスクエリーは、1つのクエリーにおいて個々のロウ(行)を取り込み、2番目の結果セットに出現しない行を返します。マイナスクエリーは交差クエリーのほぼ逆で、一般的なデータ表示ではなく、データセットからデータを差し引きます。 !minus.png! h3. Example例 Determine which customers purchased services in Year 1 and *never before*. # Firstly you will need to create a query that returns a list of customers that took part in Year 1. Athlete ID, First Name, Last Name and Year in the filter # Now select the sub query option and choose Minus. You will see a slightly different interface to the normal query builder. The purpose of this is to select a linked field or key in the master query and determine which filters you which to apply. In this example we want to link on the athlete id and filter it *different from* year 1. # The final step is to set the filters. Progress to the filters page. You will see that similar to the data page you have a tabbed set of filter attributes. Set the filter value for each filter for the specific periods required. Master query = Year of interest, Sub Query *Different From* Year of Interest. bq. See [Minus Sub Query Tutorial 年1にサービスを購入した顧客で、*それ以前には購入していない{*}顧客を特定します。 # 年1に属している顧客の一覧を返すクエリーを作成する必要があります。以下の図のように、カラム(列)フィールドに「アスリートID」、「名」、「姓」、フィルターに「年」を加えます。 # サブクエリーオプションを選択して、マイナスを選択します。通常のクエリービルダーとは少し違うインターフェースが表示されます。この目的は、マスタークエリーへリンクするフィールドまたはキーを選択して、適用するフィルターを指定することです。この例では、アスリートIDとフィルターをリンクし、年1と{*}異なる{*}値を設定します。 # 最後のステップはフィルターの設定です。フィルターのページに進みます。このページは、データページと同じようにフィルター属性のタブ型セットになっています。それぞれのフィルターに要求される期間のフィルター値を設定します。以下の図のように、マスタークエリーを指定した年と「等しい(=)」、サブクエリーを指定した年と「*と異なる(**≠)*」に設定します。 bq. 詳細については、[マイナスサブクエリーのチュートリアル|Tutorial - Minus Sub Queries] for more information. を参照してください。 h2. Advanced Sub Queries高度なサブクエリー {styleclass: Class=topLink}[topページトップ|#top]{styleclass} Advanced Sub Queries extend the basic Sub Query functionality, by allowing you to query multiple views and, in some cases, data sources. h3. Advanced Append Sub Queries These are setup exactly the same way as Basic Append Sub Queries, except that when you select them from the menu, you need to specify a Data Source and View. 高度なサブクエリーは、基本のサブクエリー機能を拡張したもので、複数のビューと、場合によってはデータソースに対するクエリーを実行することができます。 h3. 高度なサブクエリーの追加 メニューからの選択時にデータソースとビューを指定する必要がある以外は、基本サブクエリーの追加と設定はまったく同じです。 !27union.png|thumbnail,border=1! h3. Advanced高度なサブクエリーの結合 Union Subメニューからの選択時にデータソースとビューを指定する必要がある以外は、基本サブクエリーの結合と設定はまったく同じです。 Queries These are setup exactly the same way as Basic Union Sub Queries, except that when you select them from the menu, you need to specify a Data Source and View. !26append.png|thumbnail,border=1! h3. Advanced高度なマイナスサブクエリー Minus Sub Queries These are setup exactly the same way as Basic Union Sub Queries, except that when you select them from the menu, you need to specify a View. メニューからの選択時にビューを指定する必要がある以外は、基本サブクエリーの結合とまったく同じ方法で設定します。 !27minus.png|thumbnail,border=1! h3. Advanced高度な交差サブクエリー Intersect Sub Queries These are setup exactly the same way as Basic Union Sub Queries, except that when you select them from the menu, you need to specify a View. メニューからの選択時にビューを指定する必要がある以外は、基本サブクエリーの結合とまったく同じ方法で設定します。 !28intersect.png|thumbnail,border=1! bq. See [Advanced Sub Query Tutorialbq. 詳細については、[高度なサブクエリーのチュートリアル|Tutorial - Advanced Sub Queries] for more information. を参照してください。 \\ \\ {horizontalrule} {styleclass: Class=topLink}[topページトップ|#top]{styleclass} |
Page Comparison
General
Content
Integrations