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
zahidah_mabd
Helper I
Helper I

Ignore Blank Value

Hi I have a column [Job Grade] in which I separated the value by delimeter "/" into two new columns [Job_Grade.1] and [Job_Grade.2]. 

The example data is below:

Job GradeJob_Grade.1Job_Grade.2OutputReason
Z1Z1 Incorrectvalue 1 not in the list
P1/P2P1P2Correctboth values is in the list
   Correctblank is correct
P4/Q5P4Q5IncorrectValue 2 is not in the list
E1E1 CorrectValue 1 is in the list

 


The [Job Grade] should be within the values here: 
Job Grade = {"P1", "P2", "P3", "P5", "P6", "P7","A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4"}
Blank( ) values in the Job Grade is also considered correct.

I want to find the Incorrect Job Grade values (values not equal to any of the above list). Since there is a slash, I decided to separate the values into 2 columns as mentioned earlier.

So I created this measure. I works except for the fact that it considers Blank values in [Job_Grade.2] is wrong. If there is only 1 value in the main column [Job Grade] then only [Job_Grade.1] will have a value while [Job_Grade.2] will be left empty. So in this case, the measure should only cosider [Job_Grade.1] to decided if its false.

TEST = 

CALCULATE( COUNTROWS('zhpla'),

FILTER(

'zhpla',

('zhpla'[Position Assignment Category] = "Permanent ~ Executive" ||

'zhpla'[Position Assignment Category] = "Int. Secondee PET ~ Executive")

&& ('zhpla'[Job_Grade.1] <> BLANK()) &&

(NOT 'zhpla'[Job_Grade.1] IN {"P1", "P2", "P3", "P5", "P6", "P7",

"A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4"} )

&&

(NOT 'zhpla'[Job_Grade.2] IN {"P1", "P2", "P3", "P5", "P6", "P7",

"A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4", BLANK()} )

)

)+0

The [Output] and [Reason] columns are to describe the output that i want. How do I ignore the blank values? Im not sure how because right now it gives me incorrect if the 2nd value is blank eventho value 1 is correct.
Can u help me ?

3 REPLIES 3
zahidah_mabd
Helper I
Helper I

@amitchandak 
No it still doesnt work,,, it still consider empty value 2 as incorrect.
Also, I got an error when using  (not(Blank('zhpla'[Job_Grade.1]))  so i use ISBLANK instead .. like  (not(ISBLANK('zhpla'[Job_Grade.1])) but it still doesnt work.

Is it possible to to an IF condition in this case? im not sure how tho. 

Hi, @zahidah_mabd 

I think you could try treating the blank value as an element in the list as well.

Output = 
var _jobgrade={"P1", "P2", "P3", "P5", "P6", "P7","A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4",""}
RETURN
    IF (
        MAX ( zhpla[Job_Grade.1] ) IN _jobgrade
           && MAX ( zhpla[Job_Grade.2] ) IN _jobgrade,
        "Correct",
        "Incorrect"
    )

veasonfmsft_0-1657102335429.png

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@zahidah_mabd , try if this can work

 

TEST =

CALCULATE( COUNTROWS('zhpla'),

FILTER(

'zhpla',

('zhpla'[Position Assignment Category] = "Permanent ~ Executive" ||
'zhpla'[Position Assignment Category] = "Int. Secondee PET ~ Executive")

&& (not(Blank('zhpla'[Job_Grade.1])) &&

(NOT 'zhpla'[Job_Grade.1] IN {"P1", "P2", "P3", "P5", "P6", "P7",

"A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4"} )

&& (not(Blank('zhpla'[Job_Grade.2])) &&

(NOT 'zhpla'[Job_Grade.2] IN {"P1", "P2", "P3", "P5", "P6", "P7",

"A1", "A2","A3", "D1","D2","D3","E1","E2","E3","E4"} )

)

)+0

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.