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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
smmoore34
Helper III
Helper III

Measure to calculate percentage and number of users with two or more records in a table

Here is my example table:

User ID#TransactionID
1a
1b
2c
3d
4e
4f
4g

 

I want to have a measure to use in a card that shows the # and or % of customers with more than 2 transactions.

 

The result of the example table would be:

 

2 out of the 4 users had 2 or more transactions. 

50% of the users had 2 or more transactions

 

1 ACCEPTED SOLUTION
Arul
Super User
Super User

@smmoore34 ,

Try these two measures, 

1. Percentage

Percentage = 
VAR _countOfUsers =
    DISTINCTCOUNT ( 'Table'[User ID#] )
VAR _tempTable =
    SUMMARIZECOLUMNS ( 'Table'[User ID#], "@Count", COUNT ( 'Table'[User ID#] ) )
VAR _countOfTwoTransactionUsers =
    CALCULATE ( COUNTROWS ( FILTER ( _tempTable, [@Count] >= 2 ) ) )
VAR _output =
    DIVIDE ( _countOfTwoTransactionUsers, _countOfUsers )
RETURN
    _output

2. No.of Users with two or more records

No.Of Users = 
VAR _tempTable =
    SUMMARIZECOLUMNS ( 'Table'[User ID#], "@Count", COUNT ( 'Table'[User ID#] ) )
VAR _countOfTwoTransactionUsers =
    CALCULATE ( COUNTROWS ( FILTER ( _tempTable, [@Count] >= 2 ) ) )
RETURN
    _countOfTwoTransactionUsers

 





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

Proud to be a Super User!


LinkedIn


View solution in original post

6 REPLIES 6
smmoore34
Helper III
Helper III

I'd like to ask a follow up question please. Using the same table as an example: 

User ID#TransactionIDGenderAge
1aM29
1bM29
2cM41
3dF25
4eF19
4fF19
4gF19

 

I've created a page with demographics of the  unique users and now I can include the # and % of those with 2 or more transactions. Now,  I've been asked to also provide the same demograhics for the users that have 2 or more transactions. I can create a new post for this if you prefer.

Hi,

Show the exact result that you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I'd like to add an additional filter so that the user has the option to see the demogrpahics of the "repeat" clients.  My dataset is not live so I can only share a screenshot.

 

smmoore34_0-1715859643614.png

 

@smmoore34 , 

Please share more details. Separate thread also fine.





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

Proud to be a Super User!


LinkedIn


smmoore34
Helper III
Helper III

that worked perfectly!!!

Thank-you!

Arul
Super User
Super User

@smmoore34 ,

Try these two measures, 

1. Percentage

Percentage = 
VAR _countOfUsers =
    DISTINCTCOUNT ( 'Table'[User ID#] )
VAR _tempTable =
    SUMMARIZECOLUMNS ( 'Table'[User ID#], "@Count", COUNT ( 'Table'[User ID#] ) )
VAR _countOfTwoTransactionUsers =
    CALCULATE ( COUNTROWS ( FILTER ( _tempTable, [@Count] >= 2 ) ) )
VAR _output =
    DIVIDE ( _countOfTwoTransactionUsers, _countOfUsers )
RETURN
    _output

2. No.of Users with two or more records

No.Of Users = 
VAR _tempTable =
    SUMMARIZECOLUMNS ( 'Table'[User ID#], "@Count", COUNT ( 'Table'[User ID#] ) )
VAR _countOfTwoTransactionUsers =
    CALCULATE ( COUNTROWS ( FILTER ( _tempTable, [@Count] >= 2 ) ) )
RETURN
    _countOfTwoTransactionUsers

 





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

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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