Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DaniloTavecchio
Frequent Visitor

How to keep the last N rows from a log table

Hi all !

I have a Oracle log table that records some process events and this table is updated twice a week with a key formatted as a sort of progressive : YYYYnnn.

For instance the 14th run of the batch will write "2023014" in that column per each event recorded; the next run will have "2023015" and so on.

I would like to show a graph that shows only the last n run, dinamically.

The PBI dashboard is, in fact, auto updating reading the table twice in a week and I would like to have a graph like this below "rolling", considering the new lines in and leaving the old ones out. In the example I am considering the last 12 process but I manually selected from the filter menu one by one, and I have to avoid manual selection.

Below the graph you see the table contents with the information that I have to count and/or analyze. 

Thanks a lot in advance !

DaniloEBDS.jpg

2 REPLIES 2
DaniloTavecchio
Frequent Visitor

Thanks for replying me. I am not clear what is the meaning of column "VALUE" in your example: it does not mean anything to me.  What the meaning of the contents 5,9,8,6,8, etc?

Other than this I have created the numeric for ANNO_SEQ_CARICAMENTO but trying to create a new column

"RANK" it says...

"La funzione 'RANKX' non è consentita come parte di espressioni DAX della colonna calcolata nei modelli DirectQuery."  that is 

"The 'RANKX' function is not allowed as part of calculated column DAX expressions in DirectQuery models."

This is the DAX command I entered:

rank_ASCaric = RANKX(TBL_BON_TABLES_EBDS_LOG ,TBL_BON_TABLES_EBDS_LOG[anno_seq_caricamento_num],,ASC,Dense)
Thanks!
Danilo

 

Anonymous
Not applicable

Hi  @DaniloTavecchio ,

 

Here are the steps you can follow:

1. Create calculated column.

Number =
VALUE('Table'[ANNO_SEQ_CARICAMENTO])
rank =
RANKX(
    'Table','Table'[Number],,ASC,Dense)

vyangliumsft_0-1688116550006.png

2. Create measure.

Flag =
IF(
    MAX('Table'[rank]) > MAXX(ALL('Table'),[rank]) -12,1,0)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1688116550008.png

4. Result:

vyangliumsft_2-1688116710300.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.