Forum Discussion

ECC-Student's avatar
ECC-Student
New Member
10 years ago

truncation

I have a database that i load in power bi and i want to work just by the 60 last lines of table.Please how to do it? Thanks in advance.

2 Replies

  • Depends on how you want the data from database to Power BI and if want to load only the last 60 rows or load all rows by work with only the last 60 rows.  assuming it is latter one, One approach will be to add a sequnce column to the db tbale import  query as shown below (oracle syntax). 

     

    select (rownum - (select count(1) from <tablename>) + 60) as rowseq, tbl.* from <tablename> tbl

     

    Once the data is imported,  you could then filter the table in powerbi on the column named "rowseq"  to greate  than 0. 

    you could also apply this column filter on reports if you so desire.

     

    If you do not want to everload more than  last 60 lines - i would suggest filtering out in the db query itself. 

     

    Hope this helps.

     

  • arify's avatar
    arify
    Microsoft Employee

    Side note, in M, you can use Table.LastN library function.

     

    In query editor: