cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dolfvc
New Member

Power BI multiple checks with IF

I am trying to do multiple tests with a results column.

 

If any of the test fail it should display "Incorrect"

 

i.e. If the task is past it due date disply "Incorrect",

        else check if its the same date as on another column if not disply "Incorrect"

          else check if the hours allocated to the task is more than hours booked display "Incorrect"

           else disply "Correct"

 

Test =
IF (
SEARCH (
"R0",
KanBanTasks[TRS no],
1,
0
),
IF(KanBanTasks[Due Date] > (TODAY()-1),
IF(KanBanTasks[Due Date] = RELATED(T&M[RESOURCE TO DATE]),
IF(SUM(T&M[RESOURCE HOURS]) - Sum(T&M[BOOKED HRS])
"Incorrect"
),
"Correct"
)
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi,  @Dolfvc 

 

It’s my pleasure to answer for you.

According to your description,I think you can create modify your measure.

Like this:

Test =
IF (
    SEARCH ( "R0", KanBanTasks[TRS no], 1, 0 ) > 0,
    IF (
        KanBanTasks[Due Date]
            > ( TODAY () - 1 ),
        IF (
            KanBanTasks[Due Date] = RELATED ( 'T&M'[RESOURCE TO DATE] ),
            IF (
                SUM ( 'T&M'[RESOURCE HOURS] ) > SUM ( 'T&M'[BOOKED HRS] ),
                "Incorrect",
                "Correct"
            ),
            "Incorrect"
        ),
        "Incorrcet"
    ),
    "Incorrect"
)

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

View solution in original post

5 REPLIES 5
v-janeyg-msft
Community Support
Community Support

Hi, @Dolfvc 

 

Is this problem solved? If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Janey Guo

v-janeyg-msft
Community Support
Community Support

Hi,  @Dolfvc 

 

It’s my pleasure to answer for you.

According to your description,I think you can create modify your measure.

Like this:

Test =
IF (
    SEARCH ( "R0", KanBanTasks[TRS no], 1, 0 ) > 0,
    IF (
        KanBanTasks[Due Date]
            > ( TODAY () - 1 ),
        IF (
            KanBanTasks[Due Date] = RELATED ( 'T&M'[RESOURCE TO DATE] ),
            IF (
                SUM ( 'T&M'[RESOURCE HOURS] ) > SUM ( 'T&M'[BOOKED HRS] ),
                "Incorrect",
                "Correct"
            ),
            "Incorrect"
        ),
        "Incorrcet"
    ),
    "Incorrect"
)

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

View solution in original post

Hi Janey

 

Thank you so much, it is working except the "SUM ('T&M'[RESOURSE HOURS] ) > SUM ( 'T&M'[BOOKED HOURS])" 

 

This test individually works fine but within the total test its not. I am not sure if it because its a related sheet of the first search option?

 

Thank you

Dolf

Hi, @Dolfvc 

 

Since you didn't provide data, it's difficult for me to judge. If you need to distinguish between upper and lower case, you can use 'find' function. The context in the report, such as the selection of slicer, filter, and visual may affect the result, you can check it.

 

Best Regards

Janey Guo

Greg_Deckler
Super User IV
Super User IV

@Dolfvc - I highly recommend using a SWITCH statement instead. In any case use && to link logical tests together or the AND function.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors
Top Kudoed Authors