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
tnaess
New Member

Measure with top 3

Hi all. I have a few tables with data and I'm sharing some examples of what they contains.

 

This table contains general ledger transactions.

tnaess_4-1709555481123.png

 

This table contains the main accounts with its transaction type. Here the accouning year is added since the transaction type on an account can change from year to year.

tnaess_3-1709555452795.png

 

This table contains financial dimension values for the dimension 'Motpart'

tnaess_0-1709557242344.png

 

The model view is like this:

 

tnaess_7-1709555926651.png

 

Please note that the data above are only example data which doesn't add up in total.
 

I've created a simple report with table layout where I show the following columns:

- Name --> This is the legal entity name

- Controlled transactions --> This is the "Controlled transactions" from the MainAccountMapping table

- SUM --> This is a measure, showing the formula below

 
CONTROLLED TRANSACTIONS TOTAL =
CALCULATE(
    SUM('GJAE Trans'[REPORTINGCURRENCYAMOUNT]) * -1,
    FILTER(
        ALLSELECTED('MainAccountMapping'[Controlled transactions]),
        ISONORAFTER('MainAccountMapping'[Controlled transactions], MAX('MainAccountMapping'[Controlled transactions]), DESC)
    )
)

 

All this is obviously quite simple and is working as expected. What I want is a new column that is showing the country code from the table "MotpartSettings" for the top 3 motpart for the calculated sum on the report. Something like this:

 

tnaess_8-1709556037188.png

Any ideas on how to solve this?

2 REPLIES 2
Anonymous
Not applicable

Hi @tnaess ,

Please try this measure:

Country Code = CONCATENATEX(TOPN(3,CALCULATETABLE(VALUES('MotpartSettings'[COUNTRYCODE])),[CONTROLLED TRANSACTIONS TOTAL],DESC),'MotpartSettings'[COUNTRYCODE],"|")

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Hi @Anonymous ,

 

thanks a lot. Just one additional question, how do I adjust the number of contry codes to be the same as the top3? At the moment it lists more than three values.

 

tnaess_0-1709637976826.png

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.