Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power Query Function, Parameter for SCD Type 2

Hi All

 

I am tracking Student Class changes with an SCD Type 2 Dimension.. When the Class changes the it is given the End Date from the Start Date of the Class that the Student has moved into.

 

Setup is as follows

 

I have created 6 queries (1 for each collection) that references stgStudentTeachingGroups and filtered the queries to each collection.

 

I have a Query called StudentTeachingGroups which uses 01 - StudentTeachingGroups as the Source and is the Filtered Query for Collection 1.

 

Below is the code for StudentTeachingGroups - It Appends each of the queries 02 to 06 (Each of the Query Processing Section is exactly the same)after processing the SCD2.

 

How do I create a function using each query as a parameter for the append. I need to pass the APPEND each query let it do the processing then loop to the next query but I cannot figure out how to do this. Below is all the code but I think I should just be able to loop through the first Append until the queries are processed.


let
    Source = #"01 - StudentTeachingGroups",

    #"Append-Collection02" = Table.Combine({Source, #"02 - StudentTeachingGroups"}),

----------- Process Query for Collection 2 ---------------------------

    #"Append-Collection03" = Table.Combine({#"RemoveAllButCurrent-02", #"03 - StudentTeachingGroups"}),

----------- Process Query for Collection 3 ---------------------------

    #"Append-Collection04" = Table.Combine({#"RemoveAllButCurrent-03", #"04 - StudentTeachingGroups"}),

----------- Process Query for Collection 4 ---------------------------

    #"Append-Collection05" = Table.Combine({#"RemoveAllButCurrent-03", #"05 - StudentTeachingGroups"}),

----------- Process Query for Collection 5 ---------------------------

  #"Append-Collection06" = Table.Combine({#"RemoveAllButCurrent-03", #"06 - StudentTeachingGroups"}),

----------- Process Query for Collection 6 ---------------------------
 
    #"RemoveAllButCurrent-06"

 

Thanks

 

Chris

1 REPLY 1
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

I am not specific about Power Query. After search, I find some blog and thread, hope they are useful. In addition, I personally suggest you post your thread to Power Query forum to get dedicated support.

How to automate/parameterize/loop power query?
Power Query M loop table
Do … While loop with Power BI
How To Do Pagination In Power Query

 


Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.