Forum Discussion

ERing's avatar
ERing
Post Partisan
1 year ago
Solved

Is this simple Data Model correct?

I have a report currently set up with the data model below. I have two tables (Table_A, Table_B) and I need my report to show a table visual with measures from both tables.   I usually try to have ...
  • sevenhills's avatar
    sevenhills
    1 year ago

    In Power Query, Create query "DIM_STATE" as below:

    let 
        Source = Table_A,
        #"Removed Other Columns" = Table.SelectColumns(Source,{"State"}), 
    
        Source1 = Table_B,
        #"Removed Other Columns1" = Table.SelectColumns(Source1,{"State"}), 
    
        SourceCombined = Table.Combine({#"Removed Other Columns", #"Removed Other Columns1"}),
        #"Removed Duplicates" = Table.Distinct(SourceCombined),
        #"Filtered Rows" = Table.SelectRows(#"Removed Duplicates", each [State] <> null and [State] <> "" and [State] <> "null")
    in
        #"Filtered Rows"

    Output:

     

     

    ----------------------------------------------------------

    Similarly for "DIM_DEPARTMENT"

    let 
        Source = Table_A,
        #"Removed Other Columns" = Table.SelectColumns(Source,{"Department"}), 
    
        Source1 = Table_B,
        #"Removed Other Columns1" = Table.SelectColumns(Source1,{"Department"}), 
    
        SourceCombined = Table.Combine({#"Removed Other Columns", #"Removed Other Columns1"}),
        #"Removed Duplicates" = Table.Distinct(SourceCombined),
        #"Filtered Rows" = Table.SelectRows(#"Removed Duplicates", each [Department] <> null and [Department] <> "" and [Department] <> "null")
    in
        #"Filtered Rows"

     

     

    -----------------------------------------------------------

    Close and apply changes

     

    --------------------------------------------------------

     

    Adjust the data model like below: