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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

COUNT based on a measure

Hello Guys, I'm brand new to Power BI and DAX and need some Help to execute the followin.

 

I have the following table

 

ClientTarget of CallsNumber of Calls MadeAbove Target
Sales Person 118191
    Client A109No
    Client B810Yes
Sales Person 213131
    Client C56Yes
    Client D77No

 

The [Target of Calls] is a calculated Measure that I create this way: Target of Calls = COUNT(PlannedCalls[CALL_ID])
The [Number of Calls Made] is also a calculated Measure calculated by the formula: Number of Calls Made = COUNT(Calls[Call_ID])

 

I need to create a new measure to identify how many Clients were Called ABOVE target .... The last column of above table. I was able to create a column to identify if it's above Target or Not .... but now I'm not able to aggregate it on the SalesPerson level .... any idea how do it ?

 

Thanks in advance

 

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@Anonymous not sure what does that means but I guess it answered your original question, no?

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Measure1 = countrows(filter(values(Customers[Customer name]),[Number of calls]>[Target of calls]))

Drag Measure 1 to a card visual.


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

View solution in original post

11 REPLIES 11
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

Try measure as:

Count Above = 
IF(
    HASONEVALUE('Table'[Client]),
    IF(MAX('Table'[Number of Calls Made])>MAX('Table'[Target of Calls]),"Yse","No"),
    IF(
        SUMX(FILTER(ALL('Table'),'Table'[Sales Person]=MAX('Table'[Sales Person])),'Table'[Number of Calls Made])>SUMX(FILTER(ALL('Table'),'Table'[Sales Person]=MAX('Table'[Sales Person])),'Table'[Target of Calls]),
        "Yes",
        "No"
    )
)

Here is the output:

vxulinmstf_0-1631511385635.png

The demo is attached, please try it.

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

Anonymous
Not applicable

Thanks mate, but Almost there but at Sales Person line we should display the "count" of Yes , is it possible ?

Also, have in mind that there were filters apllied to Clients field

Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Measure1 = countrows(filter(values(Customers[Customer name]),[Number of calls]>[Target of calls]))

Drag Measure 1 to a card visual.


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

Guys,

 

based on your solutions, I inserted the "IF( NOT ISBLANK" and it did the trick

 

teste1 = COUNTROWS((FILTER(VALUES(Customers[Customer name]);IF(NOT ISBLANK([Target of calls]);[Number of calls]=[[Target of calls]]))))
Anonymous
Not applicable

Hi Ashish..... 

 

Well, I think I have missed something. ...... your formula did the same as the @parry2k did ...

 

The thing is that there is a filter .... for Client A and Client B for instance ... As per the test I did , its summing the clients despite the filter, só te total on Sales Person is "wrong"

 

I'm sorry I cannot share database print as it's my company confidential

 

Hi,

I cannot help you without seeing your file.


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

@Anonymous I'm still confused, you need to show the result using my measure, paste sample data, show the result what is working and what is not working? I'm shooting here in the dark with very little information 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous not sure what does that means but I guess it answered your original question, no?

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k part of It, I can make the YES or NO but the part in red below its summing all the register in client table, despite the filterw I'm using in the view

 

 

ClientTarget of CallsNumber of Calls MadeAbove Target
Sales Person 118191
    Client A109No
    Client B810Yes
Sales Person 213131
    Client C56Yes
    Client D77No
parry2k
Super User
Super User

@Anonymous try this measure

 

Count Above = 
SUMX ( VALUES ( Table[Client Column] ), IF ( [Number of Calls] > [Target of Calls], 1, 0 ) )

 

and use it in the visual.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k  almos there .... the only thing is that the total row for the salesrep is summing the whole table ... 

maybe I need to use some other parameter to achieve it .

 

and thanks a lot for the help already

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.