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
Anonymous
Not applicable

SUM of IF Statement Results

Hello Everyone,

 

Would someone be able to know how I could sum my if statement measure results in the below for "Met" category:

 

Mobafa_0-1647357083535.png

Eventually, I would like build a measure that gives the percentage of "Met" / All days.

 

When I attempt to sum the IF statement result ("Met") only ( >70%), the DAX formula bar present the following error message:

 

"a function 'placeholder' has been used in a true/false expression that is used as a table filter. This is not allowed." 

 

Is there any workaround on this problem?

 

Thank you in advance,

Mohammed

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , a measure like

 


divide(countx(filter(values('Date'[date]) , [Percent Measure] > .7),[Date]), count('Date'[date]))

 

or

 

 

divide(countx(filter(values('Date'[date]) , [Percent Measure] > .7),[Date]), calculate(count('Date'[date]), allselected()))

View solution in original post

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Does that make sense? If so, kindly mark my answer as the solution to close the case and help more people find the answer please. Thanks in advance.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create a measure.

measure =
VAR _today =
    MONTH ( TODAY () )
VAR month_ =
    MONTH ( MAX ( 'Table'[Estates] ) )
VAR _thisyear =
    YEAR ( TODAY () )
VAR date_year =
    YEAR ( MAX ( 'Table'[Estates] ) )
VAR acount_met =
    CALCULATE (
        COUNTAX ( ALL ( 'Table' ), 'Table'[met] ),
        FILTER ( ALL ( 'Table' ), _today = month_ && _thisyear = date_year )
    )
RETURN
    DIVIDE ( MAX ( 'Table'[met] ), acount_met )

vpollymsft_0-1647591223333.png

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output with more details.

 

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@amitchandak Thank you for your response, it is working an am no longer receiving the previous error!

 

However there is a little problem here where "Met" scores are divided by the entire month days.

 

Instead, how would I be able to lock the denomenator based on the given days presented in the dashboard?

i.e.(denomenator should be the # of business days in the month to date).

Mobafa_0-1647366740383.png

 

for better illustrution, my highlighted value should be (1/7 ~ 14%) instead of 3.23%:

 

Mobafa_1-1647366820231.png

 

 

Thank you kindly,

Regards,

Mo

 

amitchandak
Super User
Super User

@Anonymous , a measure like

 


divide(countx(filter(values('Date'[date]) , [Percent Measure] > .7),[Date]), count('Date'[date]))

 

or

 

 

divide(countx(filter(values('Date'[date]) , [Percent Measure] > .7),[Date]), calculate(count('Date'[date]), allselected()))

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.

Top Solution Authors