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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
firstch
Helper III
Helper III

please Help Dax for smart narrative

I really need help for using function concatenatex for the top 3 value for smart narrative 

firstch_1-1655807199313.png

how to solve  this  error smart narrative, i try to show top 3 country by total value but the country that have that product have only vietnam and china so its error as picture ,but other product workfine

this is my DAX 

firstch_2-1655807457445.png

 




thankyou in advance for your help

2 ACCEPTED SOLUTIONS
v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ;

You could change it such as:

rank = 
CONCATENATEX (
    FILTER (
        ALLSELECTED ( 'financials'[Country] ),
        RANKX (
            ALL ( financials ),
            CALCULATE ( [total], ALLEXCEPT ( financials, 'financials'[Country] ) ),
            ,
            DESC,
            DENSE
        ) <= 3
    ),
    'financials'[Country],
    ",",
    [total], DESC
)

The final show:

vyalanwumsft_0-1656055053190.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ,

You could try it.

rank = 
CONCATENATEX ( FILTER( ALLSELECTED( 'Table'),[product]=MAX([product])&&
        RANKX (
            FILTER( ALLSELECTED ( 'Table'),[product]=MAX([product])),
            CALCULATE ([Total]),
            ,
            DESC,
            DENSE
    )
   
 <= 3
    ),
   'Table'[country],
    ",",
   [Total], DESC
)

The final show:

vyalanwumsft_0-1657005952008.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ,

You could try it.

rank = 
CONCATENATEX ( FILTER( ALLSELECTED( 'Table'),[product]=MAX([product])&&
        RANKX (
            FILTER( ALLSELECTED ( 'Table'),[product]=MAX([product])),
            CALCULATE ([Total]),
            ,
            DESC,
            DENSE
    )
   
 <= 3
    ),
   'Table'[country],
    ",",
   [Total], DESC
)

The final show:

vyalanwumsft_0-1657005952008.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This one is working thankyou so much sir

Best Regard
firstch

v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ,

I test your data, the result as below:

rank = 
CONCATENATEX (
    FILTER (
        ALLSELECTED ( 'Table'[country] ),
        RANKX (
            ALL ( 'Table'),
            CALCULATE ([Total], ALLEXCEPT ( 'Table','Table'[country]) ),
            ,
            DESC,
            DENSE
        ) <= 3
    ),
    'Table'[country],
    ",",
   [Total], DESC
)

The final show:

vyalanwumsft_0-1656927793640.png

Or what the result you want to output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-yalanwu-msft 
could you please include slicer with  product carbon ,output it might concat all country as picture 
the real output that i want is concat top 3 country name althrough it have only 2 country that have that product
best regard
firstch 

v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ,

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

 

Hi @v-yalanwu-msft 
this is my sample data 

yearproductcountrycontinentvalue
2020carbonBangladeshAsia111111
2020carbonLaosAsia444444
2020carbonBangladeshAsia4888888
2020carbonLaosAsia2400000
2020steelChinaAsia11111
2020steelVietnamAsia144444
2020steelChinaAsia14815254
2020steelVietnamAsia42000000
2020copperGreeceEurope187080
2020copperCambodiaAsia6631295
2020copperChileSouth America274633
2020copperSaudi ArabiaAsia60
2020copperJapanAsia1266473
2020copperTurkeyAsia337936
2020copperTunisiaAfrica2370000
2020copperNorwayEurope4173180
2020copperNicaraguaNorth America66666
2020copperNew ZealandOceania77777
2020copperBrazilSouth America2469459393
2020copperBangladeshAsia2
2020goldBulgariaEurope547704
2020goldPakistanAsia1606870
2020goldParaguaySouth America50955312
2020goldFranceEurope8934410
2020goldFinlandEurope5497000
2020goldPhilippinesAsia156250

as data from table i want to concatenatex top 3 country by value but some product have 2 country so it error as below 

firstch_0-1656908893334.png

Best Regard 
firstch

v-yalanwu-msft
Community Support
Community Support

Hi, @firstch ;

You could change it such as:

rank = 
CONCATENATEX (
    FILTER (
        ALLSELECTED ( 'financials'[Country] ),
        RANKX (
            ALL ( financials ),
            CALCULATE ( [total], ALLEXCEPT ( financials, 'financials'[Country] ) ),
            ,
            DESC,
            DENSE
        ) <= 3
    ),
    'financials'[Country],
    ",",
    [total], DESC
)

The final show:

vyalanwumsft_0-1656055053190.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi @v-yalanwu-msft 

Thankyou for your help but it still error sir

firstch_0-1656903408514.png

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.