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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Concatenate Max Values

Hi everyone, 

I have a table with Year, the provinces of the Netherlands and the substance in water. I want to show the province(s) with the highest amount of a substance per year. 

This measures works: 

MaxAmountOneProvince = 

CALCULATE(
    MAX('Province'[Province]),
               FILTER('Water',
                   'Water'[Hoeveelheid (mg/l)] = MAX('Water'[AmountSubstance])),
                   ALLEXCEPT(
                   'Water',
                   'Water'[Year],
                   'Water'[Substance]))

However, sometimes there are two or more provinces with the same max amount of substance. I tried several things, including the following measure:

MaxAmountSeveralProvinces = 
VAR MaxConcentration = MAX('Water'[AmountSubstance])
RETURN
    CONCATENATEX(
        FILTER(
            'Province',
            CALCULATE(
                MAX('Water'[AmountSubstance]),
                ALLEXCEPT(
                    'Water',
                    'Water'[Year],
                    'Water'[Substance],
                    'Provincies'
                )
            ) = MaxConcentration
        ),
        'Province'[Province],
        ", "
    )
The results are vague and incorrect (see images). I hope someone can figure out what's wrong. 
IncResults2015.pngIncResultsFosfor2015.pngIncResultsFosfor2019.pngIncResultsStikstof2019.png
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , prefer topn

concatenatex(Topn(1, allselected('Province'[Province]) , [Your Meausre], desc) , [Province])

 

You can also consider index function

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

 

TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , prefer topn

concatenatex(Topn(1, allselected('Province'[Province]) , [Your Meausre], desc) , [Province])

 

You can also consider index function

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

 

TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.