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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
StephenK
Resolver I
Resolver I

Matrix Visual Display Top Domain by Count

Hey all,

 

I need help displaying something correctly in my matrix visual. I have two tables--

1) Users Tbl

2) Domains Tbl

 

I need to display a matrix visual like the following:

UserDomain CountTop Domain
some user25google.com
another user15yahoo.com
TOTAL40google.com

 

By default, the matrix visual displays the first or last domain. Can anyone help me create a measure that will output the Domain  based on the Domain Count? The total should reflect the entire dataset irrespective of user, but by row it should show the top domain by user. Hope that makes sense!

 

Any help is appreciated.

1 ACCEPTED SOLUTION

@StephenK,

 

Your measure is missing a CALCULATE for the COUNT expression in the variables vUserDomain and vAllDomain. Alternatively, you can use a measure, resulting in an implicit CALCULATE. The correct measures are below:

 

Domain Count = COUNT ( Domains[Domain] )

Top Domain = 
VAR vUser =
    MAX ( Users[UserId] )
VAR vUserDomain =
    ADDCOLUMNS (
        SUMMARIZE ( Domains, Domains[UserId], Domains[Domain] ),
        "DomainCount", [Domain Count]
    )
VAR vUserDomainRank =
    ADDCOLUMNS (
        vUserDomain,
        "DomainRank", RANKX ( vUserDomain, [DomainCount],, DESC, DENSE )
    )
VAR vUserTopDomainRow =
    FILTER ( vUserDomainRank, [DomainRank] = 1 )
VAR vUserTopDomain =
    MAXX ( vUserTopDomainRow, Domains[Domain] )
VAR vAllDomain =
    ADDCOLUMNS (
        SUMMARIZE ( Domains, Domains[Domain] ),
        "DomainCount", [Domain Count]
    )
VAR vAllDomainRank =
    ADDCOLUMNS (
        vAllDomain,
        "DomainRank", RANKX ( vAllDomain, [DomainCount],, DESC, DENSE )
    )
VAR vAllTopDomainRow =
    FILTER ( vAllDomainRank, [DomainRank] = 1 )
VAR vAllTopDomain =
    MAXX ( vAllTopDomainRow, Domains[Domain] )
RETURN
    IF ( HASONEVALUE ( Users[UserName] ), vUserTopDomain, vAllTopDomain )

 

DataInsights_0-1604098097031.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

11 REPLIES 11

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.