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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
atrigodaroza
Frequent Visitor

Calculate number of clients above a certain value

Hello everyone,

I'm having trouble with this measure. I would like to calculate the number of clients with a reception rate above 75%. Here's a simplified version of my dataset :

ClientMonth of packagereception Status
BFA01/22

Received

COL01/22Not received
BFA02/22Received
COL02/22

Received

 

So basically, I would like to show with a measure how many clients have a received more than 75% of all packages (one package a month). In this simple example, the measure would have "1" as a result, as only one client is above the 75% reception mark.

 

It would be even better if the result would be in % of all clients. So the final result would be 50%, as in 50% of clients have a received more than 75% of all their packages.

Thank you very much in advance for your help. I hope this is clear 🙂

 

Antonio Trigo da Roza

 

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @atrigodaroza 

try to write a measure like this:

75PlusClientRate = 
VAR _table = 
ADDCOLUMNS(
    VALUES(TableName[Client]),
    "Rate",
    VAR _received =
    CALCULATE(
        COUNT(TableName[reception status]),
        TableName[reception status]="Received"
    )
    VAR _allstatus = 
    CALCULATE(
        COUNT(TableName[reception status])
    )    
    RETURN
    DIVIDE(_received, _allstatus)
)
VAR _ClientCount = COUNTROWS(VALUES(TableName[Client]))
VAR  _75PlusClientCount = 
COUNTROWS(FILTER(_table, [Rate]>=0.75))
RETURN 
DIVIDE(_75PlusClientCount, _ClientCount)

 

With your data sample, it worked like this:

FreemanZ_0-1674476403553.png

View solution in original post

hi @atrigodaroza 

the intermediate count measure is like:

75PlusClientCount = 
VAR _table = 
ADDCOLUMNS(
    VALUES(TableName[Client]),
    "Rate",
    VAR _received =
    CALCULATE(
        COUNT(TableName[reception status]),
        TableName[reception status]="Received"
    )
    VAR _allstatus = 
    CALCULATE(
        COUNT(TableName[reception status])
    )    
    RETURN
    DIVIDE(_received, _allstatus)
)
VAR _ClientCount = COUNTROWS(VALUES(TableName[Client]))
VAR  _75PlusClientCount = 
COUNTROWS(FILTER(_table, [Rate]>=0.75))
RETURN 
_75PlusClientCount

FreemanZ_1-1674476511654.png

 

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @atrigodaroza 

try to write a measure like this:

75PlusClientRate = 
VAR _table = 
ADDCOLUMNS(
    VALUES(TableName[Client]),
    "Rate",
    VAR _received =
    CALCULATE(
        COUNT(TableName[reception status]),
        TableName[reception status]="Received"
    )
    VAR _allstatus = 
    CALCULATE(
        COUNT(TableName[reception status])
    )    
    RETURN
    DIVIDE(_received, _allstatus)
)
VAR _ClientCount = COUNTROWS(VALUES(TableName[Client]))
VAR  _75PlusClientCount = 
COUNTROWS(FILTER(_table, [Rate]>=0.75))
RETURN 
DIVIDE(_75PlusClientCount, _ClientCount)

 

With your data sample, it worked like this:

FreemanZ_0-1674476403553.png

Wow! Thank you so much, this worked perfectly.

Only added a "+0" at the end so the result is never null.

Thanks again @FreemanZ !

 

Antonio

hi @atrigodaroza 

the intermediate count measure is like:

75PlusClientCount = 
VAR _table = 
ADDCOLUMNS(
    VALUES(TableName[Client]),
    "Rate",
    VAR _received =
    CALCULATE(
        COUNT(TableName[reception status]),
        TableName[reception status]="Received"
    )
    VAR _allstatus = 
    CALCULATE(
        COUNT(TableName[reception status])
    )    
    RETURN
    DIVIDE(_received, _allstatus)
)
VAR _ClientCount = COUNTROWS(VALUES(TableName[Client]))
VAR  _75PlusClientCount = 
COUNTROWS(FILTER(_table, [Rate]>=0.75))
RETURN 
_75PlusClientCount

FreemanZ_1-1674476511654.png

 

amitchandak
Super User
Super User

@atrigodaroza , If you displaying at the client level

 

Divide( Countrows(filter(Table, Table[reception Status] = "Received")), Countrows(Table) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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