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
Dolfvc
Frequent Visitor

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.

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
Super User

@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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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
Top Kudoed Authors