cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

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

Upcoming Events

Experience what’s next for Power BI

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors