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
ld17
Helper II
Helper II

Adding conditions to an IF statement for blanks

I have a matrix to show completion dates for trainings for users. On the advice of a solution in this forum, I have cross joined tables and used a DAX formula so that if a cell shows "blank," it means that they were not assigned it. However, my issue is that I need to set a few additional conditions for this, as a blank can also mean a few other things: if a user currently has a training "in progress" or is "registered" but not started.  Therefore, I would like the blanks to be transformed to these respective values when this is the case. I believe I just need to add a few extra conditions to my IF statement, but I cannot figure out how, given that I am not a DAX expoert. The screenshots below show my codes, the column I would like to reference, and the table I am trying to use to achieve this.

 

Table = 

CROSSJOIN ( VALUES ( 'Site Services Training Matrix'[User - User Full Name]), VALUES ( 'Site Services Training Matrix'[Training - Training Title] ))
Completion Date = VAR vResult =

    CONVERT (

        LOOKUPVALUE (

            'Site Services Training Matrix'[Transcript - Transcript Completed Date],

            'Site Services Training Matrix'[User - User Full Name], 'Table'[User - User Full Name],

            'Site Services Training Matrix'[Training - Training Title], 'Table'[Training - Training Title]

        ),

        STRING

    )

RETURN

    IF ( ISBLANK ( vResult ), "Not Assigned", vResult)

 

ld17_0-1675433574010.png

ld17_0-1675433863998.png

 

1 ACCEPTED SOLUTION
ld17
Helper II
Helper II

Figured this out with the help of another user. Thanks for all of the help!

View solution in original post

5 REPLIES 5
ld17
Helper II
Helper II

Figured this out with the help of another user. Thanks for all of the help!

FreemanZ
Super User
Super User

hi @ld17 

what is your question or expectation?

I am wondering how I can add the conditions "in progress" or "registered" to the IF ISBLANK statement below?

 

    IF ( ISBLANK ( vResult ), "Not Assigned", vResult)

I only want the cell to display "not assigned' if the user didn't receive the training at all. Otherwise, I need it the cell to read "in progress" or "not started," but I cannot figure out how to write this DAX. It should read from this column:

 

ld17_1-1675436431749.png

 

Currently, the DAX formula is transforming all blanks as shown below, but some cells need to read "in proress" or "not started."

 

ld17_0-1675436326379.png

 

 

hi @ld17 

change to  something like this:

IF ( vResult IN {BLANK(), "in progress", "registered"}, "Not Assigned", vResult)

 

Thank you for the response! I tried to add that to my DAX expression, but it did not seem to pull in all the statuses. It seems to only want to give me two:

 

ld17_2-1675692477690.png

 

I guess my issue that I need to reference both of the below highlighted columns in one DAX expression. If a person has completed the training, I want the date to display in the cell of that user's name in my visualization. Otherwise, I would like "in progress," "in progress/past due," or "registered," to display in the cell. But since the date comes from one column (transcript-transcript completed date), and the status comes from a different column ((transcript-transcript status), I am not sure what DAX expression to write to include both.

 

ld17_1-1675691083737.png

 

After some tweaks, I have found that this DAX expression will produce the status, but removes the date since the date is in a separate column:

 

Completion Date = VAR vResult =

    CONVERT (

        LOOKUPVALUE (

            'Site Services Training Matrix'[Transcript - Transcript Status],

            'Site Services Training Matrix'[User - User Full Name], 'Table'[User - User Full Name],

            'Site Services Training Matrix'[Training - Training Title], 'Table'[Training - Training Title]

        ),

        STRING

    )

RETURN

      IF ( ISBLANK ( vResult ), "Not Assigned", vResult)

 

And this, the original I was working with, shows the date and "not assigned," but I cannot figure out how to get it to grab the other statues ("in progress, "in progress / past due," "or registered," since they are in a different column:

 

Completion Date = VAR vResult =

    CONVERT (

        LOOKUPVALUE (

            'Site Services Training Matrix'[Transcript - Transcript Completed Date],

            'Site Services Training Matrix'[User - User Full Name], 'Table'[User - User Full Name],

            'Site Services Training Matrix'[Training - Training Title], 'Table'[Training - Training Title]

        ),

        STRING

    )

RETURN

    IF ( ISBLANK ( vResult ), "Not Assigned", vResult)

 

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