Reply
HankScorpio2
Frequent Visitor
Partially syndicated - Outbound

Table VALUES(Table) with count of Occurence of each item.

Hi

 

I have created a table with Values on a column of text values which are the agent statuses when logging in and out. 

Would like to create a count of how many times each status occurred. 

 

 

 

 

 

 

Statuses = VALUES('Agent Status Summary'[Status])

 

 

 

 

 

 

 

This creates the table and returns as expect the unique strings. 

 

But how do I get the count of each occurence of each value in the next column.

Currently it returns the count of all.

HankScorpio2_0-1719457560055.png

I have tried ifferent variants of formulas like 

 

 

 

 

Count = CALCULATE(COUNTROWS('Agent Status Summary'),ALLEXCEPT('Agent Status Summary','Agent Status Summary'[Status]))

 

 

 

 

 

 

 

Count = COUNTX(VALUES('Agent Status Summary'), [Status])

 

 

 

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Syndicated - Outbound

Hi @HankScorpio2 ,

 

VALUES returns the distinct values of a referenced column in a calculated table but doesn't aggregate. Try this instead:

Summary =
ADDCOLUMNS (
    SUMMARIZE ( Data, Category[Category] ),
    "Count", CALCULATE ( COUNTROWS ( Data ) )
)

danextian_0-1719458709363.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-yiruan-msft
Community Support
Community Support

Syndicated - Outbound

@danextian Thanks for your contribution on this thread.

Hi @HankScorpio2 ,

You can follow the steps belwo to get it:

1. Create a measure as below:

 

Count =
VAR _status =
    SELECTEDVALUE ( 'Agent Status Summary'[Status] )
RETURN
    COUNTROWS (
        FILTER ( 'Agent Status Summary', 'Agent Status Summary'[Status] = _status )
    )

 

2. Create a table visual: drag the field 'Agent Status Summary'[Status] and the above new measure onto the visual

vyiruanmsft_0-1719910307080.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Syndicated - Outbound

@danextian Thanks for your contribution on this thread.

Hi @HankScorpio2 ,

You can follow the steps belwo to get it:

1. Create a measure as below:

 

Count =
VAR _status =
    SELECTEDVALUE ( 'Agent Status Summary'[Status] )
RETURN
    COUNTROWS (
        FILTER ( 'Agent Status Summary', 'Agent Status Summary'[Status] = _status )
    )

 

2. Create a table visual: drag the field 'Agent Status Summary'[Status] and the above new measure onto the visual

vyiruanmsft_0-1719910307080.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
danextian
Super User
Super User

Syndicated - Outbound

Hi @HankScorpio2 ,

 

VALUES returns the distinct values of a referenced column in a calculated table but doesn't aggregate. Try this instead:

Summary =
ADDCOLUMNS (
    SUMMARIZE ( Data, Category[Category] ),
    "Count", CALCULATE ( COUNTROWS ( Data ) )
)

danextian_0-1719458709363.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Syndicated - Outbound

Hi what does Data represent in your model, a measure?

Syndicated - Outbound

SUMMARIZE is a table function so it can be applied to a physical or virtual table only.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)