skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Getting started
      • Overview
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power BI Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power BI
    • Desktop
    • Service
    • Report Server
    • Power Query
    • Mobile Apps
    • Developer
    • DAX Commands and Tips
    • Custom Visuals Development Discussion
    • Health and Life Sciences
    • Power BI Spanish Community
    • Translated Spanish Desktop
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Training and Consulting
    • Instructor Led Training
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    • Ideas
    • Custom Visuals Ideas
    • Issues
    • Issues
    • Events
    • Upcoming Events
    • Community Engagement
    • T-Shirt Design Challenge 2023
    • Community Blog
    • Power BI Community Blog
    • Custom Visuals Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • Concatenated list of top items

    Concatenated list of top items

    08-23-2017 17:28 PM

    Dennes
    Frequent Visitor
    4013 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Dennes
    Dennes
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Concatenated list of top items

    ‎08-23-2017 05:28 PM

    NAME:

    Concatenated list of top items

     

    DESCRIPTION:

    Concatenates a list of top X items based on the sum of a measure. It's good for use as a tooltip for several visuals

     

    (This measure is similar to the existing 'Concatenated list of values', but this measure uses the sum of a measure to select the top X items)

     

    PARAMETERS:

    Name: Concatenate Field

    Tooltip: The field that will be concatenated

    Type: Categorical field

     

    Name: Data Field

    Tooltip: The field that will be used to define the top X items to concatenate

    Type: Numeric Field/Measure

     

    Name: Number of Values

    Tooltip: If there are more than this number of values, 'more...' will be added to the end of the string

    Type: Integers

     

     

    DAX:

    Top {Concatenate Field} by {Data Field}=

    var qty= DISTINCTCOUNT({Concatenate Field})
    Return
    if (qty >{Number of Values};
         CONCATENATEX(

            TOPN({Number of Values};

               TOPN({Number of Values};

                    ADDCOLUMNS (VALUES ( {Concatenate Field} );
                               "Total"; CALCULATE ( SUM ( {Data Field} ) );

               [Total];DESC)

             );

         {Concatenate Field} & "(" & Format([Total]/1000000;"Currency") & "M)";", ";[Total];DESC)

         & " e mais";
         CONCATENATEX(

              ADDCOLUMNS (VALUES ( {Concatenate Field} );
                               "Total"; CALCULATE ( SUM ( {Data Field} ) );

         {Concatenate Field} & "(" & Format([Total]/1000000;"Currency") & "M)";", ")

    )

     

    Example:

     

    I used the WorldWideImportersDW sample database to build a very small report illustrating this measure. The PBIX file is in attach.

     

    The image below shows the measure being used as a tooltip for the visual, I highlighted the measure:

     

    QuickMeasure.png

     

    eyJrIjoiZWVlYjg3NjYtMGJjYS00ZTFmLWE4ZDUtNmMyMTk0YjdkYzQxIiwidCI6IjQ3YTY0Y2UzLTNlYmItNGIxYS05MjBjLTU3NWY5Yjg5MjA2OSJ9

    Preview file
    30 KB
    quickMeasureSample.pbix
    Labels:
    • Labels:
    • Totals
    Message 1 of 1
    4,013 Views
    0
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices