cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## If Statement Trouble

Need help for this to calculate properly. Stops at 4.
Attendance Measure =
If(sum('Monthly Goals'[Attendance Goal]) - sum(Attendance[Unexcused Hours Taken]) = 0,0,
If(sum('Monthly Goals'[Attendance Goal]) - sum(Attendance[Unexcused Hours Taken]) >=1,4,
If(sum('Monthly Goals'[Attendance Goal]) - sum(Attendance[Unexcused Hours Taken]) <=4,4,
If(sum('Monthly Goals'[Attendance Goal]) - sum(Attendance[Unexcused Hours Taken]) >4,8
))))
2 REPLIES 2
Highlighted
Super User II

## Re: If Statement Trouble

Try this:

``````Attendance Measure =
VAR Amount =
SUM ( 'Monthly Goals'[Attendance Goal] ) - SUM ( Attendance[Unexcused Hours Taken] )
VAR Result =
IF ( Amount = 0, 0, IF ( Amount >= 1 && Amount <= 4, 4, IF ( Amount > 4, 8 ) ) )
RETURN
Result``````

or

``````Attendance Measure =
VAR Amount =
SUM ( 'Monthly Goals'[Attendance Goal] ) - SUM ( Attendance[Unexcused Hours Taken] )
VAR Result =
SWITCH (
TRUE (),
Amount = 0, 0,
Amount >= 1 && Amount <= 4, 4,
8
)
RETURN
Result``````

Thank you,
Antriksh Sharma
Highlighted
Super User III

## Re: If Statement Trouble

If the value is greater than 4 , it's also greater than 1 so it's already been dealt with.

Also use a variable and a switch statement instead.

Announcements

#### Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

#### Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021