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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jasperdavid
Frequent Visitor

count the amount of a measure

Hey guys,

 

i have a pbix file based on excel values to calculate the performance of different suppliers for each month

they get a total score on 100 based on 5 categories (amount of claims/ amount of returned parts/ etc...)

For each categorie they get a score and then total score on 90 is calculated with a measure = score cat1 + score cat2 + score cat3.

then we divide them in levels (we have 4 levels)

LEVEL = if([Total score]=90;1;if(75<[Total score];2;if(65<[Total score];3;4)))
 
now i want to know the amount of level 4 suppliers (so the worst suppliers) for a given month. 
I tried count/calculate etc but for the life of me i cannot find which function i should use to count the measure values...
 
 
1 ACCEPTED SOLUTION

@jasperdavid not sure I can go thru all this but I think this is what you need:

 

Count supplier with 4 = 
COUNTX ( 
VALUES ( Table[Supplied] ), 
IF ( [Level] = 4, 1 )
)

 



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

5 REPLIES 5
parry2k
Super User
Super User

@jasperdavid please share sample data with expected output. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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.

i have a table (see below) with the calculation of each score. Then a total score is summed up from which the supplier level is derived.

formulas below.

 

Notifications score =

VAR NumNo = COUNT(Notifications[DENV Notification No.])
RETURN

if(
isblank(
NumNo);
15;
if(NumNo<2;
15;
IF(NumNo<4;
10;
if(NumNo<7;
5;
0))))
PPM score = if([PPM]>1125;0;if([PPM]>375;10;IF([PPM]>75;30;40)))
PPM sample score = if ( [PPM Parts inspection] < 5000 ; 15; if([PPM Parts inspection] < 100000; 10; if([PPM Parts inspection] < 500000;5;if([PPM Parts inspection]>500000;0;"error"))))
Measurement Report score = if([NG measuring reports] = 0; 5; IF([NG measuring reports] = 1; 3; 0))
Management scoreEVAL = if(ISBLANK(AVERAGE(Notifications[Management score]));10;AVERAGE(Notifications[Management score]))
Avg 8D response time = AVERAGE(Notifications[8D report cycle time])
Total score = [Notifications score]+[PPM score]+[Measurement Report score]+[PPM sample score]+[Response time score]+[Management scoreEVAL]
LEVEL = if([Total score]=90;1;if(75<[Total score];2;if(65<[Total score];3;4)))
 
 
 
supplier eval pbi issue.png
 

 

@jasperdavid not sure I can go thru all this but I think this is what you need:

 

Count supplier with 4 = 
COUNTX ( 
VALUES ( Table[Supplied] ), 
IF ( [Level] = 4, 1 )
)

 



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.

worked like a charm... thanks man!

 

I first tried this one because i'm used to work with the if function returning 1 or 0 but that gave the wrong results:

 

Count supplier with 4 = COUNTX ( VALUES ( Table[Supplied] ), IF ( [Level] = 4, 1; 0 ) )

 

then i just tried this one and it works perfectly

Count supplier with 4 = COUNTX ( VALUES ( Table[Supplied] ), IF ( [Level] = 4, 1 ) )

 

any insights what might make the calculation different?

Thanks again!

@jasperdavid in your first DAX it is counting all the rows but 2nd DAX because else condition is returing BLANK() value and countx function is not calculating BLANK() values and you are getting correct result. Hope it make sense.

 

Would appreciate Kudos 🙂 if my solution helped.



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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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