Περιεχόμενο Μαθήματος
Common Errors
Σε αυτήν την ενότητα θα συζητηθούν κοινά λάθη που γίνονται στο Power Query, μαζί με την επίλυση αυτών.
0/2
Calendar Table
Αυτή η σύντομη ενότητα, προσφέρει τον Μ κώδικα για την δημιουργία ενός Calendar table.
0/3
Τελικό Project
Σε αυτή την ενότητα θα συζητηθεί εκτενώς ποιο είναι το τελικό project, ποιος είναι ο στόχος του, τι αναμένω ως καθοδηγήτρια από εσάς σχετικά με το τελικό project, πώς αναμένετε να είναι η συνεργασία μας και διάφορες οδηγίες επιτυχίας του project.
0/4
Επιπλέον Πηγές και Αξιολόγηση
Εδώ θα βρείτε διάφορα Cheatsheets, Youtube Videos, Άρθρα και e-books τα οποία μπορούν να σας βοηθήσουν στην επέκταση γνώσεων επί του θέματος του μαθήματος. Επίσης, θα αξιολογήσετε το μάθημα πιο λεπτομερώς.
0/6
Power BI: Πρακτικές Data Cleaning & Μοντελοποίησης Δεδομένων
Σχετικά με το Μάθημα

Template: Calendar Table


  • Open Power BI Desktop and click on the “Transform data” button to open Power Query Editor.
  • In Power Query Editor, click on the “Home” tab, and then click on “New Source” and select “Blank Query.”
  • Rename the query by double-clicking on “Query1” in the “Queries” pane, and typing in a new name, such as “DateTable.”
  • Open advanceδ editor and paste below Code:

let

    // Set the start and end date for the date table

    StartDate = #date(2020, 1, 1),

    EndDate = #date(2021, 12, 31),

 // Create a list of dates from the start to end date

    DateList = List.Dates(StartDate, Duration.Days(EndDate - StartDate) + 1, #duration(1,0,0,0)),

    // Convert the list to a table and add columns for year, month, day, etc.

    DateTable = Table.FromList(DateList, Splitter.SplitByNothing(), {"Date"}),

    #"Changed Type" = Table.TransformColumnTypes(DateTable,{{"Date", type date}}),

    #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Date]), Int32.Type),

    #"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([Date]), Int32.Type),

    #"Inserted Day" = Table.AddColumn(#"Inserted Month", "Day", each Date.Day([Date]), Int32.Type),

    #"Inserted Weekday" = Table.AddColumn(#"Inserted Day", "Weekday", each Date.DayOfWeek([Date]), Int32.Type),

    #"Inserted MonthName" = Table.AddColumn(#"Inserted Weekday", "MonthName", each Date.ToText([Date], "MMMM"), type text),

    #"Inserted MonthNameShort" = Table.AddColumn(#"Inserted MonthName", "MonthNameShort", each Date.ToText([Date], "MMM"), type text),

    #"Inserted QuarterNo" = Table.AddColumn(#"Inserted MonthNameShort", "QuarterNo", each Date.QuarterOfYear([Date]), Int32.Type),

    #"Inserted YearQuarter" = Table.AddColumn(#"Inserted QuarterNo", "YearQuarter", each Text.Combine({Text.From([Year]), " Q", Text.From([QuarterNo])}), type text),

    #"Inserted YearMonth" = Table.AddColumn(#"Inserted YearQuarter", "YearMonth", each Text.Combine({Text.From([Year]), "-", Text.PadStart(Text.From([Month]), 2, "0")}), type text),

    #"Inserted YearMonthDay" = Table.AddColumn(#"Inserted YearMonth", "YearMonthDay", each Text.Combine({Text.From([Year]), Text.PadStart(Text.From([Month]), 2, "0"), Text.PadStart(Text.From([Day]), 2, "0")}), type text),

    #"Added Custom Column" = Table.AddColumn(#"Inserted YearMonthDay", "Month,Year", each Text.Combine({[MonthNameShort], ",", Text.Middle(Text.From([Year], "en-IN"), 2)}), type text),

    #"Inserted Merged Column" = Table.AddColumn(#"Added Custom Column", "Quarter", each Text.Combine({"Q", Text.From([QuarterNo], "en-IN")}), type text),

    #"Inserted Day Name" = Table.AddColumn(#"Inserted Merged Column", "WeekDay Name", each Date.DayOfWeekName([Date]), type text)

in

    #"Inserted Day Name"

  • Close and apply the changes to the query by clicking on the “Close & Apply” button.
  • Once you have completed these steps, you will have a fully functional date table in Power BI using Power Query.

Benefits of having Calendar Table

  1. Query Performance,
  2. Make calculations easier,
  3. Provide consistency in date formatting.
0% Ολοκληρωμένο
Κύλιση στην κορυφή