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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Krutika124
New Member

Group values based on recent 5 records and show in single row (cone)

I have below data

Run RUNID Job TerminalStatetime
XYZ1FailedThu, 13 Feb 2025 13:19:05
XYZ2FailedThu, 13 Feb 2025 13:03:42
XYZ3SuccessFri, 07 Feb 2025 07:21:55
XYZ4FailedFri, 07 Feb 2025 07:07:52
XYZ5FailedWed, 05 Feb 2025 15:43:51
XYZ6SuccessFri, 17 Jan 2025 07:38:35
XYZ7SuccessFri, 17 Jan 2025 07:35:55

I need output in below format: 

Run Job TerminalState
XYZFailed Failed Success Failed Failed
1 ACCEPTED SOLUTION
Deku
Super User
Super User

 

Can add this to a table in your report with Run id to get the last 5 status

measure = 
CONCATENATEX( 
   TOPN( 5, table1, table1[Time], desc )
   , table1[JobTerminalState], " ", table1[Time], desc
)

 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

13 REPLIES 13
manikumar34
Solution Sage
Solution Sage

@Krutika124 ,

Measure =
VAR a=
FILTER(ADDCOLUMNS('Table',"rank",RANKX(ALL('Table'[Run ],'Table'[time]),'Table'[time],,DESC)),[rank]<=5)

RETURN
CONCATENATEX(a,[Job TerminalState],",")
manikumar34_0-1742228900747.png

On above screenshot table is filtered to top 5, if you do not want to do that then use the below DAX. 

Measure =
VAR a=
FILTER(ADDCOLUMNS('Table',"rank",RANKX('Table','Table'[time],,DESC)),[rank]<=5)

RETURN
CONCATENATEX(a,[Job TerminalState],",")
manikumar34_0-1742229326579.png

 





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Deku
Super User
Super User

 

Can add this to a table in your report with Run id to get the last 5 status

measure = 
CONCATENATEX( 
   TOPN( 5, table1, table1[Time], desc )
   , table1[JobTerminalState], " ", table1[Time], desc
)

 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thanks Thats is working 😊 One more thing, If this status we would like to show with Icon then ?
I have tried but it is showing only one status with icon

Krutika124_0-1742229680339.png

 

manikumar34_0-1742230754392.png

 





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




measure = 
CONCATENATEX( 
   TOPN( 5, table1, table1[Time], desc )
   , SWITCH(
       table1[JobTerminalState],
       "Failed", "",
       "Cancelled", "",
       "Succeeded", "✔️"
    ),
    , " ", table1[Time], desc
)

Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thanks. But not working DAX gives error for below 

" ", table1[Time], desc

I tried removing it but gives no data

 

I have a extra , on that row at the start, need to remove that


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Yes removed but no data it gives. 

ah, You might have to find and enter emoji's yourself as the forum converts them into a funny format 

 

https://emojipedia.org/check-mark


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thanks...one last question. If I have to keep only the unique value in status then What I have to give?

 

 

measure = 
CONCATENATEX( 
   DISTINCT(
      SELECTCOLUMNS( 
         TOPN( 5, table1, table1[Time], desc )
         ,table1[JobTerminalState]
     )
   )
   , SWITCH(
       table1[JobTerminalState],
       "Failed", "emoji 1",
       "Cancelled", "emoji 2",
       "Succeeded", "emoji 3"
    ),
    " "
)

 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

I am using below DAX:

CONCATENATEX(
 distinct(SELECTCOLUMNS(TOPN( 5, Table1, Table1[__time], desc ),"table1",table1[RUNID]))
   ,[table1],","
)

I am getting below output for RUNID but it should contain unique values.
 
Run RUN IDJob TerminalState
XYZ1,2,1,1Failed Failed Success Failed Failed
Krutika124
New Member

I am able to get the output like this. But I need to show only recent run status (like only 5 recent states)
I have used the DAX to get this:

DatabricksVisual = concatenatex(Filter(Table1,[Run]  = earlier(Table1[Run]) ) , [jobTerminalState]," " )
Run Job TerminalState
XYZFailed Failed Success Failed Failed Failed success Failed

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors