Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Referenced table or GROUPBY table

Hi all,

 

I have a scenerio whereby I have a Master table (MasterCodes) with a list of codes organised by Identifier TYPE (Catalogue/SubCat/Format etc). Currently I split this table into 10 individual tables, referencing the Master table, to create a table for each Identifier.

e.g.

let
Query = MasterCodes,
TYPE = Table.SelectRows(Query, each ([Identifier] = "SubCat"))
in
TYPE

 

My model is getting quite large and PBI takes ages to respond, so I'm trying different ways to improve.

 

Is the above method the best way, or should I create a dax table with GROUPBY? What performance benefits would I get from either?

e.g.

Table_SubCat = FILTER(GROUPBY(MasterCodes, MasterCodes[Identifier], MasterCodes[Code], MasterCodes[Description]), MasterCodes[Identifier] = "SubCat")
Table_Format = FILTER(GROUPBY(MasterCodes, MasterCodes[Identifier], MasterCodes[Code], MasterCodes[Description]), MasterCodes[Identifier] = "Format")
 
The splitting of the tables is required for references.
I have a table called Panel, which has various fields relating to different Codes, (Catalogue, SubCat, Format etc). Since I can't have a filter on a relationship in the model I need to have them in different tables.
 
 
The original SQL would have looked like this:
 
from Panels p
left outer join MasterCodes ms1 on ms1.Code = p.FormatCode and ms1.Identifier= 'Format'
left outer join MasterCodes ms2 on ms2.Code = p.SubCatCode and ms2.Identifier= 'SubCat'
 
 
 

4 Replies

  • Hi Anonymous ,

     

    First thing, why you are creating multiple tables for different TYPE from your master table?

    What kind of visualisations you are trying to achieve using these individual tables?

     

    Please answer above in order to understand what you are trying to acive in these tables.

     

    Thanks,

    Pragati

    • Anonymous's avatar
      Anonymous
      Not applicable

      I've updated the original post

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    I prefer you to use Table.selectrows() in power query:

    1. Power query statement cleans the undering data of your model, although it could take a long time if your model is very large, you can get a succinct data table and use it to create another tables and visuals by dax easily.
    2. Dax query statement only process surface data of your model. For example, if your model is very large without any filter, it will fully load into power bi and dax will calculate all of your data based on your model. If you use groupby to create other tables, it could take such a longer time than power query.

    In conclusion, if your model is very large, using power query to clean data in advance is better than using dax directly, although both of them can get the same result finally.

     

    You can also refer these articles about differences between dax and power query in details:

    1. Do You Know the Differences Between M and DAX in Power BI? 
    2. M or DAX? That is the Question! 

    Best Regards,
    Yingjie Li

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly. Thanks!


    Best Regards,
    Yingjie Li