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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
prajwal1
Frequent Visitor

Display total no of customers in totals and customer names in column of table visual

Hey guys, I need to display the customer names as a column in table visual and count of cutomers in the Totals of the same column just like below. Please help me with some ideas. Thanks in advance.

 

RowCustNames
1A
2B
3C
4D
Total4
2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @prajwal1 
You can try

CustNames =
IF (
    ISINSCOPE ( 'Table'[Customer Name] ),
    SELECTEDVALUE ( 'Table'[Customer Name] ),
    DISTINCTCOUNT ( 'Table'[Customer Name] )
)

View solution in original post

tamerj1
Super User
Super User

Hi @prajwal1 
Please refer to attached sample file withthe proposed solution

1.png

CustNames = 
IF (
    HASONEVALUE ( 'Index'[Row Number] ),
    MAXX ( 
        FILTER ( 
            ADDCOLUMNS ( 
                VALUES ( 'Table'[Customer Name] ),
                "@Rank", RANKX ( ALLSELECTED ( 'Table'[Customer Name] ), 'Table'[Customer Name],, ASC )
            ),
            [@Rank] = VALUES ( 'Index'[Row Number] )
        ),
        'Table'[Customer Name]
    ),
    DISTINCTCOUNT ( 'Table'[Customer Name] )
)

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @prajwal1 
Please refer to attached sample file withthe proposed solution

1.png

CustNames = 
IF (
    HASONEVALUE ( 'Index'[Row Number] ),
    MAXX ( 
        FILTER ( 
            ADDCOLUMNS ( 
                VALUES ( 'Table'[Customer Name] ),
                "@Rank", RANKX ( ALLSELECTED ( 'Table'[Customer Name] ), 'Table'[Customer Name],, ASC )
            ),
            [@Rank] = VALUES ( 'Index'[Row Number] )
        ),
        'Table'[Customer Name]
    ),
    DISTINCTCOUNT ( 'Table'[Customer Name] )
)

Hello @tamerj1  ,

 

Your solution is just perpect but I have another level of difficulty would be great if you can suggest. 
Table Details.pngIssue.png


In the table I have measure value as well which is giving wrong value with CustName column. 
Can you help !!


Hi @poojadc_i 
You can do the following:

1.png

tamerj1
Super User
Super User

Hi @prajwal1 
You can try

CustNames =
IF (
    ISINSCOPE ( 'Table'[Customer Name] ),
    SELECTEDVALUE ( 'Table'[Customer Name] ),
    DISTINCTCOUNT ( 'Table'[Customer Name] )
)

This is working when the original column is there in the table. How can I do this without using that column in the table.?

@prajwal1 
Which column are you going to use in the table? Or you you want to see the result on a card visual? Please clarify 

Not in a Card. I want to display in a table visual like I mentioned in my question.

I want to display Customer names in a column and the total number of customers in 'Totals' in table visual without using the original column in the table.

The above Dax expression working when the original column is also available in the table visual. I don't want to use that column. I will use the measure only

@prajwal1 

I understand, but there must be some column placed there in the table. Such solutions cannot be straightforward as it should provide a workaround over this property of power bi table. I'll be back to office shortly. Let me see what can I do. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.