DYNAMICALLY Remove All Empty Columns with some M MAGIC in Power BI

Поділитися
Вставка

КОМЕНТАРІ • 77

  • @alexandrudumitrache2594
    @alexandrudumitrache2594 3 роки тому +1

    You, Bas, are a Gentleman and a Scholar!
    I salute you!

  • @tomduffhues622
    @tomduffhues622 3 роки тому +3

    This is extremely helpful with export data which might or might not have columns which contain data and prevent 'missing' data because it is suddenly added while using a manual select columns. Thanks!

  • @laurentmarc1928
    @laurentmarc1928 3 роки тому +4

    you're a genius guy ! Always a pleasure to learn with you :-)

  • @EricaDyson
    @EricaDyson 2 роки тому +1

    Great. Just what I need right now! So well explained for us lesser mortals. Thanks a lot.

  • @NikWatts
    @NikWatts 7 місяців тому

    Really helpful - thanks. Particularly useful when inheriting upstream source data that is not under your control. 350 columns down to 36 useful ones in one easy step.

  • @nikhargesumit9069
    @nikhargesumit9069 3 роки тому +2

    I am great fan of yours. I strongly believe u will have 100K subscribers very soon

    • @HowtoPowerBI
      @HowtoPowerBI  3 роки тому +1

      that's so nice to hear!! thx a lot for watching all the videos, really appreciate it 😀 .. oh man, 100k still seems very far away, but I hope you are right haha 😉

  • @benponderin
    @benponderin 2 роки тому

    I saw another video similar to this but your solution is way better! Thanks, you're a legend!

  • @rerangelt
    @rerangelt 3 роки тому +1

    Well Buzz, great video. A great trick and great explanation! Love your videos. Grettings from Colombia.

    • @HowtoPowerBI
      @HowtoPowerBI  3 роки тому

      Thx Rafael for watching again!!! greetings from Germany 😉

  • @pravinshingadia7337
    @pravinshingadia7337 Рік тому

    You're awesome! Please keep doing these - you're much better than AI!

  • @robertmichellopezmoya931
    @robertmichellopezmoya931 2 роки тому

    Man, really appreciate your effort on this video, I has been very helpful

  • @10ozGold
    @10ozGold 2 роки тому

    That's brilliant! Sooo good. Excellent video, thank-you Bas!

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому

      You are welcome! Glad you like it :)

  • @RaviGupta-mo1nf
    @RaviGupta-mo1nf 3 роки тому +1

    Here is a simple method ,which I tried on your data set, and it worked!!
    I used List.Sum to check if a row is returning ONLY null value & filtered it out.
    After transposing the table, add a custom column :
    Table.AddColumn(#"Transposed Table", "Check for Null Row", each List.Sum({[Column2],[Column3],[Column4]}))
    Now an error would be obtained for the date row (1st row in this case).
    Replace error with a zero value.
    Filter out rows that are null in the new column.
    Transpose
    Promote headers
    Filter OUT the zero value to ensure Date column does not have an unwanted record or row.
    Change Type to ensures dates show up as dates and not as numbers
    Thats it !!

    • @mohammadshaikh1191
      @mohammadshaikh1191 3 роки тому

      Hi @Ravi
      Thanks for sharing your solution, did you test this method with large data, how much refresh time it takes as compared to small data, have you used QUERY DIAGNOSTICS to check for the times that this step takes against large datasets?

    • @HowtoPowerBI
      @HowtoPowerBI  3 роки тому

      Hi Ravi, thx for sharing! 🙂
      what is the advantage over just filtering out the null / blank rows straight away?... like this you need to know in advance the names of the columns,.. 2 - the transpose option is slow

  • @bravucod
    @bravucod 3 роки тому +1

    Brilliant! Really well done !!

  • @KenLoewen
    @KenLoewen 2 роки тому

    Great technique. Extremely well explained. Thanks, Bas!

  • @ThrillsofAwe
    @ThrillsofAwe 2 роки тому

    this guy is just amazing! you helped me a lot man!!

  • @sadyaz64
    @sadyaz64 3 роки тому +1

    You are a master in m language, more vidéo please

  • @cesarpadovani
    @cesarpadovani 3 роки тому +1

    Very good! 👏👏👏 Thanks for sharing.

  • @ТонБо
    @ТонБо Рік тому

    Very simple and nice smile)

  • @amyhunter6728
    @amyhunter6728 Рік тому

    Marvellous! Extremely helpful!!

  • @aymx
    @aymx 2 роки тому

    That's a great tip, very helpful. Thank you so much. I used it in Excel Power Query.

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому

      nice 😀 happy to hear it helped you

  • @stevemorris4938
    @stevemorris4938 Рік тому

    Really helpful - Thank you!!

  • @Pjotterbolte
    @Pjotterbolte 3 роки тому

    Awesome! Definitely going to use it soon!

  • @txreal2
    @txreal2 Рік тому +1

    Expanding on your example. Let's say I want to keep only column(s) that have 75% or more of non-null (out of 1000), so instead of 0, I guess I can do >= 750?
    Also, it would be better if I can express it as 75%, instead of total number of rows as 750 above.
    Any ideas is appreciated. Thanks and keep up the good work.

  • @juja2819
    @juja2819 2 роки тому

    Thank you so much! :)

  • @alejguz1552
    @alejguz1552 Рік тому

    Very Good!

  • @beginho2454
    @beginho2454 3 роки тому +1

    Thank you Bas! So cool... ;)

  • @davidferrick
    @davidferrick 3 роки тому

    Nicely done sir.

  • @alexrosen8762
    @alexrosen8762 3 роки тому

    Super useful tutorial. Thanks :-)

  • @stefanoschantzis6939
    @stefanoschantzis6939 2 роки тому

    Awesome video! the step by step creation/ explanation of the code was top tier. Thank u Bas

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому +1

      thank you so much Stefanos! that's really nice to hear!

  • @kebincui
    @kebincui 7 днів тому

    hi Bas. Thank you for your excellent video. I have a query about the Option 1 method which use transposing. In your video 1'47'', you filtered out the null value by column 2. Suppose the call centre for 10/06/2021 is non null, the call centre will be still removed just because Column2 is null. I do not feel you remove the row just using one column (Column2 in this case) is a reliable approach. Please kindly test by adding call cente to for date 10/06/2021, you will that cost centre column is removed although the call centre column is not all null. Thank you.

  • @YaElDaniels9410
    @YaElDaniels9410 2 роки тому

    I want to either hide or show columns depending on having value or not, but on table visual itself...any idea Will be really appreciated!

  • @user-uu8mi8no2m
    @user-uu8mi8no2m 3 місяці тому

    Question: I have a use case similar to this… but I’ve larger dataset 250 columns and lots of data. Out of which 100 columns are placed on matrix visualization. The visualization should show only columns which has data, otherwise hide the empty columns for selected date and Account. Could you please suggest what is the better approach

  • @albertoj8025
    @albertoj8025 2 роки тому

    Thanks! I have to add that it only works if the cells are "null", and not if they are ""

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому

      we can fix that 😄 - try this
      = List.Select(
      Table.ColumnNames(#"Replaced Value"),
      // each List.NonNullCount( Table.Column(Data_Table, _) ) 0
      each List.Count( List.Select( Table.Column(#"Replaced Value", _), each _ "" ) ) 0
      )

  • @kebincui
    @kebincui 2 роки тому

    fabulous👍👍👍👍

  • @vimukthiamarasena6264
    @vimukthiamarasena6264 2 роки тому

    this is a great a video.. but kind of confusing with underscore "_" mark??

  • @mmbcampus
    @mmbcampus Рік тому

    very nice video. If there are many random null, Let's say- I imported a query from PDF. There are so many random Null cells in power query. If I want to remove all Null cells and move data to left side(just like excel- "Delete cell--> "Shift cells left"), how can i do this? Thanks

  • @rlds07
    @rlds07 Рік тому

    Great explanation Bass. I have a problem with my data, I still have no header set, numerous columns without any data, text number in columns without typing, when I try to perform the method that taught, I get the following error: ([DataFormat.Error] Invalid cell value '#NUM!'.) Could you guide me please, I'm lost in this case.

  • @wmfexcel
    @wmfexcel 2 роки тому

    Thanks for the video. Well explained.
    May I know if it works if the data_table contains more than 1000 rows? What I mean is, if the first non-null item falls beyondthe first 1000 rows, would that column be removed?

  • @김차수-k2u
    @김차수-k2u 2 роки тому

    you are great!!!!!!!! god!!!

  • @muhammadihsan8689
    @muhammadihsan8689 Рік тому

    How can we apply this to a PowerBI Table, like remove all null columns in it

  • @owadiary
    @owadiary 2 роки тому

    Can we dynamically remove duplicate rows? Can you make a tutorial on this too?

  • @debrasimpson4986
    @debrasimpson4986 2 роки тому

    I love this but there is a problem when it comes to my dataset. The SF object that is my table has to be filtered by a field first. How do I put this piece into the mix?

  • @shadogroot8367
    @shadogroot8367 Рік тому

    Hi Sir, is this possible? In power bi, i created a matrix visual with rows division, group, category, class, subclass and brand, now I have a supplier slicer, now I want that once I filter a certain supplier, I want the division, group, category, class, subclass to be filtered only for those that has that supplier but I want to show all the brands from the filtered division, group, categories, class and subclass whether those brand is from the supplier or not. The name of the table is 'item Details'. The matrix visual to be used is only 1.

  • @j.rizwan
    @j.rizwan 3 роки тому +1

    Just fell in love with you :D

  • @FernoInferno
    @FernoInferno Рік тому

    This is super helpful but I wish you would show more of the computer screen and less of your person. I'm a little newer to things like this and I'm getting a little mixed up what you are doing where... I want to see your tables and your applied steps together. Some better table naming might help too....I'm confused if the Data_Table reference is referencing your Table called Data or is a typical function. I'll have to play some more to figure out how to use this myself but Thanks for the guidelines.

  • @lloydmisjan6757
    @lloydmisjan6757 3 роки тому

    Hi Bas I want to automatically remove columns with value 0 in my pbi query.
    do you have a tip/solution for me?

  • @filipelealdacosta9548
    @filipelealdacosta9548 3 роки тому

    Great example. But what if columns are empty instead of "null"?

    • @HowtoPowerBI
      @HowtoPowerBI  3 роки тому

      you can simply adjust the filter condition 🙂
      = List.Select(
      Table.ColumnNames(#"Replaced Value"),
      // each List.NonNullCount( Table.Column(Data_Table, _) ) 0
      each List.Count( List.Select( Table.Column(#"Replaced Value", _), each _ "" ) ) 0
      )

  • @nandafadhli869
    @nandafadhli869 2 роки тому

    Can we do this as well when doing filtering in slicer ? in case of some categories have null when not included in the filtering

    • @nandafadhli869
      @nandafadhli869 2 роки тому

      I tried this to my data, but when I do filtering for a category in the slicer. Then the result keep showing row contain null column

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому

      This is a power query solution to remove empty columns (so the part that gets the data into the right shape). Slicers have nothing to do with this. It sounds to me that you have separate columns for different (product/customer) categories. You probably need to unpivot those columns first (turn category columns into rows) - so that you have 1 column "category" with all categories and 1 column with the corresponding values.

  • @xcorect
    @xcorect 3 роки тому

    I found another way in web
    (tbl) =>
    let
    Headers = Table.ColumnNames(tbl),
    Result = Table.SelectColumns(
    tbl,
    List.Select(Headers, each List.MatchesAny(Table.Column(tbl, _), each _ null)))
    in
    Result

  • @saadnageeb4633
    @saadnageeb4633 2 роки тому

    its really good ,but not worked with me

  • @GodOfIntelligence
    @GodOfIntelligence Рік тому

    Earlier this method works but now it's not working 😭😭😭😭

  • @wiggumo
    @wiggumo 2 роки тому

    What if I've got 300,000 lines. It will crash the data.

    • @HowtoPowerBI
      @HowtoPowerBI  2 роки тому

      don't see why - option 2 works very well for me with larger data sets

    • @wiggumo
      @wiggumo 2 роки тому

      @@HowtoPowerBI ok will try it again. Is there a way to remove columns with " _1", "_2", and so fourth with numbers?