Bài viết liên quan

Tạo table MonthlyBudgetLine


31/03/2020- duocnt    852 Views    


Nội dung bài viết:

  1. Tạo table MonthlyBudgetLine.
  2. Tạo fields.
  3. Tạo Field groups.
  4. Tạo Index.
  5. Tạo Relation giữa MonthlyBudgetLine và MonthlyBudgetHeader.



THỰC HIỆN:

1 - Tạo table MonthlyBudgetLine.

 - Right-click lên project (20_MonthtlyBudgetForm) => Add => New Item.

 - Chọn Data Model => Table => Name = MonthlyBudgetLine.

2 - Tạo fields.

 - Mở table MonthlyBudgetLine vừa tạo ở chế độ Design.

 - Click chuột phải lên node Fields của table và lần lượt tạo các field như sau:

NameLabelData TypeSize
YearYearInteger
MonthNumMonthNumInteger
MonthNameMonthNameString10
BudgetBudgetReal
ActualActualReal
MarginMarginReal
RatioRatioReal

- Sau khi tạo, các field của table sẽ như sau:

3 - Tạo Field groups

 - Right-click lên node Field groups của table => New Group.

 - Right-click lên field group vừa tạo (FieldGroup1) => Properties, và thiết lập thuộc tính sau:

    + Name : Default.


 - Kéo các field sau từ node Fields thả vào Field groups Default vừa tạo:

    + MonthName.

    + Budget.

    + Actual.

    + Margin.

    + Ratio.

4 - Tạo Index.

 - Right-click vào node Indexes => New Index.

 - Thiết lập các thuộc tính cho Index1 trong Properties như sau:

    + Allow Duplicate: No.

    + Alternate Key: Yes.

    + Name: Index1.

 - Kéo các field sau từ node Fields thả vào Index1 vừa tạo:

    + Year.

    + MonthNum.

5 - Tạo Relation giữa MonthlyBudgetLine và MonthlyBudgetHeader.

 - Right-click lên node Relations của table => New => Relation.

 - Chọn Relation vừa tạo (Relation1) và thiết lập các thuộc tính ở Properties như sau:

    + Cardinality: OneMore.

    + NameMonthlyBudgetHeader.

    + On DeleteCascadeRestricted.

    + Related TableMonthlyBudgetHeader.

    + Related Table CardinalityExactlyOne.

    + Relationship TypeAssociation.

 - Right- click lên relation MonthlyBudgetHeader => New => Normal.

 - Chọn vào relation normal vừa tạo (MonthlyBudgetLine. == MonthlyBudgetHeader.) và thiết lập các thuộc tính sau trong Properties.

    +    Field: Year.

    +    Name: Year.

    +    Related Field: Year.

 - Relation sau khi hoàn thành sẽ như sau:

6 - Kết luận.

 - Kết thúcVậy là chúng ta đã xong bài thứ 2 trong Series bài viết Power BI so sánh Target với Actual.

 - Bài tiếp theo, chúng ta sẽ tiến hành tạo 1 số method trên table MonthlyBudgetHeader.


Góp ý kiến

;
;