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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
thliberato
Helper I
Helper I

TOPN

I have an Incidents table with 3 fields: Incident ID, System Name, Functional Area Name.

Capturar.JPG

 

I need to make a chart that shows the TOPN systems with the highest number of incidents (Counter must be done by the ID field).

 

In addition, I would like to make a Dynamic Filter. I created a TopNOptions table with the values 3,5,10,15 and 20. I would like to insert in canvas a TOPNOptions filter and a TOPN BAR Graph X System (The Graph show the number of Systems selected in TOPNOPTION FILTER). Somebody can help me?

Capturar.3JPG.JPGCapturar2.JPG

 

5 ACCEPTED SOLUTIONS
austinsense
Impactful Individual
Impactful Individual

First, what do we want to rank by ... # of Incidents - let's make a measure for that:

NumIncidents:= COUNTROWS(IncidentsTable)

This assumes of course that the incidents table is one row per incident, if that wasn't the case then you'd want to do a distinctcount on the incidentid

NumIncidents:=DISTINCOUNT( IncidentsTable[IncidentsID] )

Second, we want to rank the systems by the number of incidents - let's make a measure for that

RankSystemsByIncident:=RANKX( ALL( IncidentsTable[System] ), [NumIncidents] )

The piece most people miss here is the ALL() - we don't want to rank the system against itself - we want to rank the system against all the other systems.

 

Third, we want to return a certain number of systems based on a choice - let's pretend for a second that we just want to return all the systems with their rankings - we would put the systems on the rows and drop the ranking in the values. PowerBI has a TOPN function that you could play around with.

 

Shoot, I have to run to a meeting but this should get you started 🙂

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

View solution in original post

Thank you so much. It worked as expected.

View solution in original post

Hi @thliberato,

I am very glad to hear you have resolved your problem. In order to help more people, please mark the corresponding solution as answer. Thanks a lot.

Best Regards,
Angelia

View solution in original post

Hi @v-huizhn-msft, I am new and I didnt find the function (mark as answer).

 

Can you Help me again ?

View solution in original post

Hi @thliberato,

Please review the folloowing screenshot, just click the "Accept as Solution" highlighted in red line.

Capture.PNG

Best Regards,
Angelia

View solution in original post

5 REPLIES 5
austinsense
Impactful Individual
Impactful Individual

First, what do we want to rank by ... # of Incidents - let's make a measure for that:

NumIncidents:= COUNTROWS(IncidentsTable)

This assumes of course that the incidents table is one row per incident, if that wasn't the case then you'd want to do a distinctcount on the incidentid

NumIncidents:=DISTINCOUNT( IncidentsTable[IncidentsID] )

Second, we want to rank the systems by the number of incidents - let's make a measure for that

RankSystemsByIncident:=RANKX( ALL( IncidentsTable[System] ), [NumIncidents] )

The piece most people miss here is the ALL() - we don't want to rank the system against itself - we want to rank the system against all the other systems.

 

Third, we want to return a certain number of systems based on a choice - let's pretend for a second that we just want to return all the systems with their rankings - we would put the systems on the rows and drop the ranking in the values. PowerBI has a TOPN function that you could play around with.

 

Shoot, I have to run to a meeting but this should get you started 🙂

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

Thank you so much. It worked as expected.

Hi @thliberato,

I am very glad to hear you have resolved your problem. In order to help more people, please mark the corresponding solution as answer. Thanks a lot.

Best Regards,
Angelia

Hi @v-huizhn-msft, I am new and I didnt find the function (mark as answer).

 

Can you Help me again ?

Hi @thliberato,

Please review the folloowing screenshot, just click the "Accept as Solution" highlighted in red line.

Capture.PNG

Best Regards,
Angelia

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.