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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Access the nth value of a table

Hello forum,

I'm looking for a possible solution for the following problem. I need to access the umpteenth column of the table generated from the TOPN function. I read in the Power BI documentation about the LASTNONBLANK function, however in its implementation it does not work with the generated table. Any solution?

Below I share the code generated for the particular measure
Clarifications
The total_streams column contains the plays of each of the songs in the dataset. The information is obtained from the intersection of the Song, Streams, Artist and Calendar tables.

Second Most Popular Artist =
WERE Streams_Artista =
SUMMARIZE(
'Song - Streams - Artist - Calendar',
'Song - Streams - Artist - Calendar'[nombre_artista], "Streams Totales", SUM('Song - Streams - Artist - Calendar'[total_streams])
)

WERE Top_2 = TOPN(2, Streams_Artista, [Streams Totales], DESC)

WERE Segundo_Artista = (this variable should store the name of the artist who is in the second place at the top)

RETURN
Segundo_Artista
1 ACCEPTED SOLUTION
Legend_11
Resolver I
Resolver I

Segundo_Artista =
VAR Streams_Artista =
SUMMARIZE(
'Song - Streams - Artist - Calendar',
'Song - Streams - Artist - Calendar'[nombre_artista],
"Streams Totales", SUM('Song - Streams - Artist - Calendar'[total_streams])
)
VAR Top_2 =
TOPN(2, Streams_Artista, [Streams Totales], DESC)
VAR Second_Artist_Table =
TOPN(1, TOPN(2, Streams_Artista, [Streams Totales], DESC), [Streams Totales], ASC)
VAR Segundo_Artista =
SELECTCOLUMNS(Second_Artist_Table, "nombre_artista", 'Song - Streams - Artist - Calendar'[nombre_artista])
RETURN
CONCATENATEX(Segundo_Artista, [nombre_artista], ", ")

View solution in original post

1 REPLY 1
Legend_11
Resolver I
Resolver I

Segundo_Artista =
VAR Streams_Artista =
SUMMARIZE(
'Song - Streams - Artist - Calendar',
'Song - Streams - Artist - Calendar'[nombre_artista],
"Streams Totales", SUM('Song - Streams - Artist - Calendar'[total_streams])
)
VAR Top_2 =
TOPN(2, Streams_Artista, [Streams Totales], DESC)
VAR Second_Artist_Table =
TOPN(1, TOPN(2, Streams_Artista, [Streams Totales], DESC), [Streams Totales], ASC)
VAR Segundo_Artista =
SELECTCOLUMNS(Second_Artist_Table, "nombre_artista", 'Song - Streams - Artist - Calendar'[nombre_artista])
RETURN
CONCATENATEX(Segundo_Artista, [nombre_artista], ", ")

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.