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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
VAIDES
New Member

DAX Table need to relate to other table

Hi,

i have this situation , i have created a TOP N table in this way

 

top 5 jugadores = TOPN(5,
SUMMARIZE(WorldCupPlayers, WorldCupPlayers[NombreJugador], WorldCupPlayers[Iniciales ] ,  "Goles y Penales", dax_medidas[dax_total_goles mas penales]), [Goles y Penales], DESC)
 
the result is something like this
 
VAIDES_0-1662756419683.png

 

 the problem is that i Have a tooltip related to NombreJugador that I need to show, so the question is 
there is a way to RELATE dinamicaly the new "top 5 jugadores"  table with the table  WorldCupPlayers in order to have this tooltip correct ? 
Now is not working
 
this is the page for the tooltip,  refer to tables of the model, the problem is that the new Dax table is not related with any table of the model.
 
VAIDES_1-1662756548395.png

 

 
 
 
 
 
 
 
1 ACCEPTED SOLUTION

Revisiting this, I would be remiss if I didn't mention the even more straightforward way to do this by setting a top N filter straight through the UI.

1. Select your visual and open Filters pane

MarkLaf_0-1662925000635.png

2. Expand filter options of your axis in the filter pane and select the Top N option

MarkLaf_1-1662925118876.png

 

3. Select Top N option, add in the measure you want to rank by, and the desired N

MarkLaf_2-1662925348366.png

 

Same output as what I provided above. Probably the better solution for its simplicity unless you need the dynamic N functionality I mentioned at the end of my post:

MarkLaf_3-1662925398318.png

Again, going this route may circumvent your issues because you aren't creating a dynamic table just for the Top N functionality, so you can leverage the measures and relationships you've already set up.

View solution in original post

4 REPLIES 4
MarkLaf
Solution Sage
Solution Sage

You may want to avoid the issue entirely by using RANKX to filter your measure rather than construct a dynamic table. You can then use whatever already existing fields/measures related to WorldCupPlayers. This is just a guess given it's not clear exactly what you model looks like, but you can try something like this:

 

top 5 jugadores_m = 
VAR _all_m = 
    GENERATE( 
        ALL( WorldCupPlayers[NombreJugador] ), 
        ROW( "m", [dax_total_goles mas penales] ) 
    )
VAR _this_m = [dax_total_goles mas penales]
VAR _m_rank = RANKX( _all_m, [m], _this_m )
VAR _rank_cut = 5
VAR output = 
    CALCULATE( 
        [dax_total_goles mas penales], 
        FILTER( WorldCupPlayers, _m_rank <= _rank_cut ) 
    )
RETURN
output

 

If you have something like the above working, you could then take it a step further and use a numeric range parameter instead of hard-entering 5, so the user can pick top X from a slicer. E.g. example output with dummy data:

MarkLaf_0-1662763320859.png

MarkLaf_1-1662763341279.png

MarkLaf_2-1662763366385.png

 

 

 

thanks a lot i will try this solution!

Revisiting this, I would be remiss if I didn't mention the even more straightforward way to do this by setting a top N filter straight through the UI.

1. Select your visual and open Filters pane

MarkLaf_0-1662925000635.png

2. Expand filter options of your axis in the filter pane and select the Top N option

MarkLaf_1-1662925118876.png

 

3. Select Top N option, add in the measure you want to rank by, and the desired N

MarkLaf_2-1662925348366.png

 

Same output as what I provided above. Probably the better solution for its simplicity unless you need the dynamic N functionality I mentioned at the end of my post:

MarkLaf_3-1662925398318.png

Again, going this route may circumvent your issues because you aren't creating a dynamic table just for the Top N functionality, so you can leverage the measures and relationships you've already set up.

Gustavo98
Helper V
Helper V

Hi,

 

If you want to use Related Function your table has to be related with another. 

 

And has to be a relationship 1 to n or 1 to 1.

 

 

 

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors