• Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
Thursday, May 15, 2025
newsaiworld
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
Morning News
No Result
View All Result
Home Artificial Intelligence

The Distinction between Duplicate and Reference in Energy Question

Admin by Admin
May 4, 2025
in Artificial Intelligence
0
00 Intro Image.png
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

READ ALSO

Parquet File Format – All the pieces You Must Know!

Survival Evaluation When No One Dies: A Worth-Based mostly Strategy


we should load a duplicate of the identical information into Energy Question. Energy Question affords two methods to get the identical information twice: Duplicate and Reference. Let’s have a look at the distinction between these two options and when to make use of one over the opposite.

Introduction

I could must load the identical information twice into Energy Question and subsequently into Energy BI.

This may occur after I should cut up the info columns or carry out different transformations on the info, or after I must extract information from a desk in two other ways.

Energy Question affords us two options to perform this:

  • Duplicate:
    This duplicates the M-Code for the desk and creates a brand new desk.
  • Reference:
    This takes the output of a desk and creates a brand new desk. All adjustments made to the supply desk are additionally seen within the referencing desk.

You may argue that after I use Reference, the info is learn as soon as from the supply, as I take the output of 1 desk and reuse it for a distinct output.

That is what this text is about: Is that this true or false?

Getting ready the Instruments

I take advantage of SQL Server as the info supply and SQL Profiler to investigate what occurs within the database.

SQL Profiler is a Software that may intercept all of the site visitors on a SQL Server occasion.

Fortuitously, SQL Profiler is a part of SQL Server Administration Studio (SSMS) and is free to make use of.

You possibly can learn this piece on Medium for a extra detailed description of SQL Server Profiler: Mastering SQL Server Profiler: A Step-by-Step Information to Unlocking Database Insights

One other strategy to analyze the habits of those two Options is Energy Question Diagnostics.

I wrote this piece on Medium about Energy Question Diagnostics: Analyzing Energy Question with Load Traces

I invite you to learn it to seek out out extra about this device.

However let’s return to SQL Server Profiler and tips on how to begin it and put together it for our particular situation.

I can begin SQL profile from the Begin Menu or straight from SSMS:

Determine 1 – Begin SQL Profiler from SSMS (Determine by the Writer)

After beginning it, I have to choose the connection to my native SQL Server Occasion:

Determine 2 – Connect with SQL Server (Determine by the Writer)

Subsequent, I arrange the Hint.

  1. I give it a Title and choose the TSQL template to trace the queries coming from Energy Question.
  2. I activate the “Save to File” possibility and choose the folder for the Hint file.
    I can later open this hint file in Profiler and look into it in additional element if I want.
  3. I change to the second web page, “Occasion Choice”
  4. I activate the 2 choices “Present all occasions”.
  5. Within the checklist of all Occasions, I choose SQL:StmtStarting and SQL:StmtCompleted to get the SQL code from the queries.
  6. I deselect all occasions, besides the three under SQL.
  7. I deselect most columns besides these to trace the Question Textual content, Begin and Finish Time, Length, and different statistics.

That is the way it takes care of the setup (With the choice “Present all occasions” deactivated):

Determine 3 – Setup of the Hint in SQL Profiler (Determine by the Writer)

Lastly, I arrange a filter on my supply database to hint solely the site visitors on that database:

Determine 4 – Arrange a filter on my supply database, ContosoRetailDW_Big (Determine by the Writer)

With out this filter, I’ll get the site visitors on all databases. This will likely be overwhelming for a manufacturing occasion as there will likely be lots of site visitors from different functions and customers. I’d even add a filter to limit the hint to observe just for site visitors from my NTUserName (My Home windows Person ID) to exclude all different site visitors on the database.

Now I click on on Run to begin the Hint.

Importing the Information into Energy Question

I take advantage of a View within the database named FactOnlineSales_withCustomer as my supply.

I import this View into Energy Question with out every other transformation steps. It will trigger Energy Question to get the info with a easy SQL Question from the database.

I can discover this question with out issue within the Hint Log.

Create a Duplicate and examine what occurs.

After importing the info into Energy Question, I create a Duplicate of the imported desk and cargo the info into Energy BI:

Determine 5 – Create a Duplicate of a desk in Energy Question (Determine by the Writer)

As anticipated, I see the identical Question executed twice in SQL Profiler:

Determine 6 – The hint results of Duplicate (Determine by the Writer)

You possibly can see that the info has been retrieved twice with the identical variety of rows (The final two strains within the hint.

I anticipated this to occur, as Duplicate copies the M-Code to create a brand new desk.

One other key column is SPID. That is the inner session ID on the SQL Server occasion. Two completely different SPIDs point out that Energy Question began to separate connections to get the info twice.

This column will likely be vital when analyzing the site visitors from a Referencing desk.

Create a Reference and examine what occurs.

Now, I attempt the Reference function.

I first delete the desk “FactOnlineSales_WithCustomer_Duplicate” and create a Reference from the unique “FactOnlineSales_WithCustomer” desk:

Determine 7 – After deleting the duplicated desk, I create a Reference from the unique desk (Determine by the Writer)

In SQL Profiler, I can clear the view to see solely new entries by clicking on the eraser button to clear the hint (This won’t delete any information from the saved Hint file):

Determine 8 – Clear the Hint Home windows to see solely new entries (Determine by the Writer)

After refreshing the Information from Energy BI, I get this end in SQL Profiler:

Determine 9 – End in SQL Profiler after refreshing the info from each the unique and the referenced desk (Determine by the Writer)

Astonishingly, the info was learn twice within the database.

I can see that there are undoubtedly two connections, because the column SPID (Session ID) has two completely different numbers for the 2 SQL:StmtCompleted entries.

Which means, from the load site visitors perspective, there isn’t any distinction between duplicating and referencing a desk.

However when each trigger the identical site visitors on the supply, why ought to I take advantage of Duplicate over Reference in Energy Question?

When utilizing Reference and when Duplicate

A while in the past, I wrote an article about changing a flat desk to a Star Schema with Energy Question: Changing a Flat Desk to a Good Information Mannequin in Energy Question

On this article, I described that some operations will not be attainable when creating a brand new desk by referencing an current desk.

For instance, Energy Question doesn’t permit merging a referencing desk with the unique desk due to a round reference.

In such a case, I have to duplicate the unique desk.

It is because a referencing desk is all the time based mostly on the final step of the referenced desk.

That is the important thing distinction between “Duplicate” and “Reference” in Energy Question:

  • Duplicate is a wholly new load with out dependency on the unique desk. Modifications to the unique desk don’t have an effect on the duplicated desk.
  • A Referencing desk is predicated on the end result of the referenced desk. Consequently, adjustments utilized to the referenced desk are mechanically utilized to the referencing desk.
    To be exact, the adjustments will not be utilized, however the enter desk adjustments due to the change within the referenced desk.

However when you have to extract a subset from the unique desk with out altering the unique desk, Reference is the best way to go, particularly when it’s very important to all the time get the output from the referencing desk.

In order for you a desk from the identical supply however don’t need adjustments to the unique desk utilized to the brand new desk, then you have to duplicate the unique desk.
Bear in mind that Duplicate means a duplication of the Load logic. Which means whenever you apply a change to the unique desk, you may want to repeat the logic to the duplicated desk as nicely.

Potential for Conflicts throughout load

One other potential difficulty is that load conflicts can happen when loading information from some sources. Excel is certainly one of these sources that may trigger issues.

The supply of the issue is that Energy Question tries to load the info in parallel. Some sources will not be in a position to deal with parallel connections.

In such a case, you have to change a parameter to keep away from parallel loading:

Determine 10 – Setting the parameter for parallel loading. You may must set this to “One (disable parallel loading)” to show off parallel loading completely (Determine by the Writer)

The default worth is 4.

If issues happen, you may must set both a decrease Customized worth or set it to “One (disable parallel loading)” to keep away from any points altogether.

Conclusion

In Energy Question, there isn’t any distinction between “Duplicate” and “Reference” relating to load efficiency or community site visitors.

Each load the info independently from the supply with a separate connection.

Due to this fact, I debunked the parable that “Reference” can improve load efficiency.

Nonetheless, understanding these two options’ variations is important, as they provide distinct potentialities when loading and remodeling information.

Anyway, when loading information from a relational database, I might create two queries or two views for the 2 tables, as an alternative of offloading any transformation to Energy Question.

In line with Roche’s maxim of Information Transformation:

Information needs to be reworked as far upstream as attainable, and as far downstream as needed.

However when loading textual content, Excel information, or different sources to which I can not ship a question to get the info in the best way I want it, I have to use both “Duplicate” or “Reference” based on the required final result.

References

Like in my earlier articles, I take advantage of the Contoso pattern dataset. You possibly can obtain the ContosoRetailDW Dataset without spending a dime from Microsoft right here.

The Contoso Information could be freely used underneath the MIT License, as described on this doc.

I modified the dataset to shift the info to up to date dates.

Tags: DifferenceDuplicatePowerQueryReference

Related Posts

Image 109.png
Artificial Intelligence

Parquet File Format – All the pieces You Must Know!

May 14, 2025
Cover.png
Artificial Intelligence

Survival Evaluation When No One Dies: A Worth-Based mostly Strategy

May 14, 2025
Image 81.png
Artificial Intelligence

How I Lastly Understood MCP — and Bought It Working in Actual Life

May 13, 2025
Chatgpt Image May 10 2025 08 59 39 Am.png
Artificial Intelligence

Working Python Applications in Your Browser

May 12, 2025
Model Compression 2 1024x683.png
Artificial Intelligence

Mannequin Compression: Make Your Machine Studying Fashions Lighter and Sooner

May 12, 2025
Doppleware Ai Robot Facepalming Ar 169 V 6.1 Ffc36bad C0b8 41d7 Be9e 66484ca8c4f4 1 1.png
Artificial Intelligence

How To not Write an MCP Server

May 11, 2025
Next Post
Nansen Review Featured Image.jpg

Is It the Smartest Cryptocurrency Analytics Instrument in 2025?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

POPULAR NEWS

Gemini 2.0 Fash Vs Gpt 4o.webp.webp

Gemini 2.0 Flash vs GPT 4o: Which is Higher?

January 19, 2025
0 3.png

College endowments be a part of crypto rush, boosting meme cash like Meme Index

February 10, 2025
How To Maintain Data Quality In The Supply Chain Feature.jpg

Find out how to Preserve Knowledge High quality within the Provide Chain

September 8, 2024
0khns0 Djocjfzxyr.jpeg

Constructing Data Graphs with LLM Graph Transformer | by Tomaz Bratanic | Nov, 2024

November 5, 2024
1vrlur6bbhf72bupq69n6rq.png

The Artwork of Chunking: Boosting AI Efficiency in RAG Architectures | by Han HELOIR, Ph.D. ☕️ | Aug, 2024

August 19, 2024

EDITOR'S PICK

Gen Ai Ad Campaigns A Trend On Rise.webp.webp

5 Thoughts-Blowing GenAI Advert Campaigns

December 2, 2024
Antony Turner Spells Blockdags Vision Fuels 64m Presale Success Amid Cosmos Price Challenges Uniswap Upgrade.jpg

Antony Turner Spells BlockDAG’s Imaginative and prescient; Fuels $64M Presale Success Amid Cosmos Worth Challenges & Uniswap Improve

August 1, 2024
Data Shutterstock 1055190668 Special.jpg

GPUs Driving Innovation Past AI Tasks, New Hammerspace Report Reveals

October 23, 2024
Img 7dkywbvcnb3gjibkeghtlnct 800x457.jpg

Bitfinex analysts count on $48,900 as short-term backside for Bitcoin

August 5, 2024

About Us

Welcome to News AI World, your go-to source for the latest in artificial intelligence news and developments. Our mission is to deliver comprehensive and insightful coverage of the rapidly evolving AI landscape, keeping you informed about breakthroughs, trends, and the transformative impact of AI technologies across industries.

Categories

  • Artificial Intelligence
  • ChatGPT
  • Crypto Coins
  • Data Science
  • Machine Learning

Recent Posts

  • Kraken completes latest Proof of Reserves, elevating the bar for crypto platform transparency
  • LangGraph Orchestrator Brokers: Streamlining AI Workflow Automation
  • Intel Xeon 6 CPUs make their title in AI, HPC • The Register
  • Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy

© 2024 Newsaiworld.com. All rights reserved.

No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us

© 2024 Newsaiworld.com. All rights reserved.

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?