Gå till huvudinnehåll

Anpassa fält och grupper

PÅ DEN HÄR SIDAN

Anpassa fält och grupper

Nästa steg när du ska anpassa din logiska modell är att definiera dina fält och grupper. Fält och grupper är basnivån i den logiska modellen. All other logical model elements use these groups.

When you enable a custom logical model, Qlik Sense automatically creates default groups from your data model. It also sets the properties of all your fields. Some of these groups and field properties need to be adjusted. Qlik Sense will make a best interpretation of your data model, but it is not always correct in which fields should be hidden or which fields are measure, for example.

Fields & groups, with default groups

Fields and groups, displaying the default groups and field values applied by business logic

Det finns tre typer av grupper:

  • Dimension: A dimension group consists of related fields that are classified as dimensions. Dimensionsgrupper kan innehålla fält som är klassificerade som mått eller datum.

  • Mått: En måttgrupp består av inbördes relaterade måttfält. Bara mått kan ingå i en måttgrupp.

  • Kalender: En kalendergrupp består av en tidsdimension i din logiska modell. Calendar groups can only contain dimensions and must have at least one temporal fields (such as date, timestamp, or year).

Within each group are fields with four properties:

  • Synlighet Defines if a field is visible or not in Insight Advisor. Hidden fields can still be used in analysis, such as when a user searches for that field.

  • Klassificering Defines the default role the field plays in analysis. Classifications can be broad, such as dimension, or specific, such as city.

  • Slå upp datavärde Styr om användare ska kunna söka efter specifika värden i det här fältet. Att minska antalet fält som har Slå upp datavärde aktiverat kan hjälpa till att undvika falska resultat och minska frågetiden.

  • Standardaggregering Sets the standard aggregation for measures in Insight Advisor. När ett fält har en standardaggregering använder alltid Insight Advisor den aggregeringen när fältet används som ett mått. Användare kan redigera Insiktsdiagram och ändra till en annan typ av aggregering i Insight Advisor.

Fields can be ungrouped. Ungrouped fields belong to no group and are excluded from analysis.

Why define fields and groups?

Defining fields and groups enables you to set the defaults of how fields and master items are handled. When you define fields, you set the preferences on how they are handled by Insight Advisor. Exempel:

  • Should this field be available for analysis in Insight Advisor?

  • Should this field be used as a dimension or measure? What kind of dimension or measure?

  • Can Insight Advisor look up individual values from the field in searches?

  • What should the default aggregation for the field be when used as a measure?

When you define groups, you show Insight Advisor which fields are closely related and should be used together in analysis. Groups are used to create other business logic features, such as packages, calendar periods, and behaviors.

Customizing your fields and groups

You are going to start by cleaning up some of the field properties to change visibility and adjust a few classifications. You are then going to ungroup some of the fields from the groups. With these fields, you will make the following new groups:

  • Customer

  • SalesCity

  • SalesCountry

  • Order date

  • SupportCalls

  • SupportDate

Some fields you will leave ungrouped. Ungrouped fields are not used by Insight Advisor in any analysis. This will remove fields that are not relevant to analysis, such as ID and GeoInfo fields

Customizing field properties

  1. Navigate to Fields & groups.

  2. In Employees, adjust the following fields:

    • For Extension, set the following properties:

      • Visibility: visible
      • Classification: dimension

      • Slå upp datavärde Nej

      • Standardaggregering Not specified

    • For EmployeeName, set the following properties:

      • Visibility: visible

      • Classification: dimension

      • Slå upp datavärde Ja

      • Standardaggregering Inte specificerad

    • For Hire Date, set the following properties:

      • Visibility: visible

    • For Reports To, set the following properties:

      • Visibility: hidden

        Classification: dimension

      • Slå upp datavärde Ja

      • Standardaggregering Not specified

    • For Title , set the following properties:

      • Visibility: visible

    • For Year Salary, set the following properties:

      • Visibility: visible

      • Classification: monetary

      • Slå upp datavärde Nej

      • Standardaggregering Summa

  3. In Sales Data_ENT, set the fields as follows:

    1. For Address, set the following properties:

      • Visibility: hidden

    2. For CountryCode, set the following properties:

      • Visibility: hidden

Ungrouping fields

  1. In Offices, select Offices.SalesOffice_GeoInfo.

  2. In Categories, select CatID-CategoryID.

  3. In Suppliers, select the following:

    • SupplierID

    • Suppliers.SupllierCountry_GeoInfo

  4. In SupportCalls, select the following:

    • SupportCalls.EmployeeID

    • Date

    • SupportCalls

    • AverageCallSatisfaction

  5. In Products, select ProductID.

  6. In Employees, select EmployeeID.

  7. In Sales Data_ENT, select the following fields:

    • Address

    • City

    • ContactName

    • Country

    • CountryCode

    • Customer

    • CustomerID

    • Latitude

    • Longitude

    • Longitude_Latitude

    • OrderDate

    • OrderID

    • Phone

    • PostalCode:

    • ShipperID

    • Sales Data.City_GeoInfo

    • Sales Data.CountryCode_GeoInfo

  8. Click Ungroup.

Creating Customer group

This group will let you group together dimension fields relating to customer information.

  1. Klicka på Skapa grupp.

  2. For Group name, enter Customer.

  3. For Group type, select Dimension.

  4. Add the following fields to the group:

    • Address

    • ContactName

    • Customer

    • Phone

    • PostalCode:

  5. Klicka på Skapa.

Creating SalesCity group

This group will let you group together dimension fields relating to city information. You will use this later when making a hierarchy.

  1. Klicka på Skapa grupp.

  2. For Group name, enter City.

  3. For Group type, select Dimension.

  4. Add the following fields to the group:

    • City

    • Longitude_Latitude

  5. Klicka på Skapa.

Creating SalesCountry group

This group will let you group together dimension fields relating to country information. You will use this later when making a hierarchy.

  1. Klicka på Skapa grupp.

  2. For Group name, enter Country.

  3. For Group type, select Dimension.

  4. Add the followings fields to the group:

    • Country

    • CountryCode

  5. Klicka på Skapa.

Creating Order date group

Next, create a calendar group for OrderDate as it is the primary date field of your data model. This will let you use when you create calendar periods later.

  1. Klicka på Skapa grupp.

  2. For Group name, enter Order date.

  3. For Group type, select Calendar group.

  4. Add the following fields to the group:

    • OrderDate

  5. Klicka på Skapa.

Creating SupportCalls group

You removed all fields from the previous SupportCalls group as it was classified as a dimension group. You will use the fields to make a measure group.

  1. Klicka på Skapa grupp.

  2. For Group name, enter SupportCalls.

  3. For Group type, select Measure.

  4. Add the following fields to the group:

    • AverageCallSatisfaction

    • SupportCalls

  5. Klicka på Skapa.

Creating SupportDate group

Finally, you will make a calendar group for the Date field from the support calls data.

  1. Klicka på Skapa grupp.

  2. For Group name, enter SupportDate.

  3. For Group type, select Calendar group.

  4. Add the following fields to the group:

    • Date

  5. Klicka på Skapa.

Resultat

Go to Insights in the Analyze tab and look at the Assets panel. There is a significantly reduced number of fields in Assets. The ID fields are no longer there, for example.

Fields in Assets panel in Insights

Insight advisor with business logic applied. The Assets panel has hidden many fields that were not relevant from analysis.

Now, search for what is the profit by employee. This time, instead of EmployeeID, Insight Advisor uses EmployeeName, a more useful field to use as a dimension in visualizations.

Resultat för frågan what is the profit by employee

Profit by employee query results. A bar chart showing the sum of Gross Profit by EmployeeName is the matching result. Additional results are displayed. They show a Value table showing gross profit for each employee and a combo chart showing the contribution of employee name to gross profit.