Data Model Newbie


Three main questions (each identified below for easy reference back)...


Background: While well versed in Excel, pivots, and fairly complex matters in that realm, I've never used Excel as a sql tool.  In just having recently created a new pivot, I was offered the option of including it in a data model.



Am I generally correct in my understanding that if I have the following:


- essentially a list of base transaction 'units' (the essential elements off of which I need to run numerous calculations, including calculations of interim calculations)


then current to reduce file size one of my best bets is to use this in a 'data model' and use query language to run numbers off of there?



If I'm correct in the above, is it as simple as creating that list of base elements, telling Excel "treat this as the data", and then using SQL language to ping against that data?


Again, newbie so apologies if the above are obvious.



It's been a long while since I played with SQL language, but am I correct that if my data looks something like the attached, then I could do any number of the following types of calculations:


- for all the Large agencies that joined in the May-'19 timeframe, aggregate the amount of professionals that were in those agencies and multiply them by 5 (which means that first the calculation has to be done to say "take the ProsPerAgency number in May-19, for large agencies...multiply that number against the number of agencies that joined in May-19...then multiply that result by 5"


These are just calculations that represent the kind of layered calculations (and some of the calculations would have 3-5 interim calculations involved) that I'd be looking at doing.  I need to refresh my understanding of general approach that SQL and Excel data models allows for this.  I know how to do it with a series of pivot tables, but that doesn't seem efficient.


This is obviously a fraction of the data, so even though something may appear only once here, in the full dataset, the aggregation would actually yield math that I can't do on a calculator (which for this data extract I can do).  Don't anyone thinking I'm trying to run a data model on 50 lines of data.   :)


Thanks for helping me get back on my feet with SQL and Excel modeling.  As I read about it, the potential seems there to transform the way I do complex calculations.  Just need to understand how the data itself needs to be structured in Excel, and then a quick few pointers on how query language handles the kinds of things I'm looking to calculate.

3 Replies

Hi @txrussianguy ,


In general Excel is not SQL tool, you may use SQL query in connectors to SQL databases. In Excel to transform data is used Power Query, it has its own M-script language and rich user interface. I many cases only UI is enough to transform data, in particular transformations as you say could be done within it. Result is returned back to Excel sheet as Excel table.


Data model (Power Pivot and DAX language) if you'd like to add any measures and return result back as PivotTable (however, could be also Excel table).


Not sure about file size, don't think you reduce it compare with PivotTables only, especially if you don't save PivotTable cache within the file.


@Sergei Baklanthanks very much.  I never save cache on pivots, and figured that this might be my easier near-term solution. 


@txrussianguy , yes, if you uncheck this default setting file size could be reduced significantly