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

If the result is 0 then count as 1 Problem

Hi Power BI Community!

DoA rate.PNG

I want that the DoA rate is 100 % when DoA Count = 1 and Count of parts = 0

This is my measure. I thought about a IF function but I need this measure to show values with zero on my chart in the right time fraim.
DOA rate (monthly) = var result =(DIVIDE('Parts per Month'[DoAs], [Count of Parts]))+0
return if(result, result, IF(MAX(Dates[Date2])>DATE(2019,9,30),0, BLANK()))

Can I add to this measure another function so that it counts every DoA Count with zero count of parts as 1?

1 ACCEPTED SOLUTION

@Anonymous - Well, you shouldn't, you should use SWITCH(TRUE()...) but if you must:

 

IF(

  <condition>,

  IF(

     <other condition>,

     <result true>, 

     <result false>

  ),

  <result first if is false>

)

 

Or if you mean logic, IF(<condition> && <other condition>,true,false)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous - If you have a measure for "DoA Count" and "Count of Parts" and they work, can you just do this:

DoA Rate =
  IF([DoA Count]=1 && [Count of Parts]=0,1,BLANK())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Thank you for your reply. How can I include a second IF fuction?

DoAs DOA rate (monthly) = var result =(DIVIDE('Parts per Month'[DoAs DOA], [Count of Parts]))+0
return if(result, result, IF(MAX(Dates[Date2])>DATE(2019,9,30),0, BLANK())) -> I need this for the visual

How can I add this without destroying my former measure: 
IF ('Parts per Month'[DoAs DOA]=1 && [Count of Parts]=0,1,BLANK())

@Anonymous - Well, you shouldn't, you should use SWITCH(TRUE()...) but if you must:

 

IF(

  <condition>,

  IF(

     <other condition>,

     <result true>, 

     <result false>

  ),

  <result first if is false>

)

 

Or if you mean logic, IF(<condition> && <other condition>,true,false)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , Not very clear to me

Assume you have two measures DoA Count  and Count of parts , then you can have a measure

 

if([DoA Count] = 1 && [Count of parts] = 0,1 ,[DOA rate (monthly)])

 

You can use one measure inside another one. When want to filter using a measure, you need to take care of row context

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 
Thank you for the reply. I have the two measure DoA Count and Count of parts

DoA Count = var result =
CALCULATE (
COUNT ( 'Stammdaten Komplett'[ID] ),
FILTER ( Dates, MAX ( Dates[Date2] ) > DATE ( 2019, 9, 30 )),
FILTER (
'Stammdaten Komplett',
'Stammdaten Komplett'[PartStatus] = "Dead on arrival (DOA)"
)
)
return if(result, result, IF(MAX(Dates[Date2])>DATE(2019,9,30),0, BLANK()))

Count of Parts = var result = SUM('All Parts'[adjusted quantity])
return if(result, result, IF(MAX(Dates[Date2])>DATE(2019,9,30),0, BLANK()))

Where should I put the new IF measure in both of them? I am sorry - still a beginner...


@Anonymous , if is fine but check value or result 

result  >0 

result <> 0

isblank(result ) 

not(isblank(result ))

do not just give results in if unless the true-false value is expected. It might work. But may change result ay someplace 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.