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

ISEMPTY function returning FALSE although no matching records in table

Hi All,

 

I wrote below measure to be able to display only current users records in the dashboard:

 

LoggedInUserIsPm =

VAR CurrentUser = USERPRINCIPALNAME()

 

VAR LoggedInUserEmail =
DISTINCT(SELECTCOLUMNS(
FILTER(PM_Table, PM_Table[EMPLOYEE_USER_PRINCIPAL_NAME] = CurrentUser), "EMPLOYEE_E_MAIL", [EMPLOYEE_E_MAIL]))

 

VAR IsPm = ISEMPTY(CALCULATETABLE(ReportTable, ReportTable[project_manager_email] = LoggedInUserEmail ))

 

VAR countMatchRows = COUNTROWS(CALCULATETABLE(ReportTable, ReportTable[project_manager_mail] = LoggedInUserEmail ))

 

Return

"Email: " &LoggedInUserEmail&" IsPm? "& IsPm &" CountMatchingRows "& countMatchRows


Outcome - Email: IsPm? False CountMatchingRows 9

 

There is no matching record in 'PM_Table' for currently logged in user's email address, hence 'LoggedInUserEmail' is blank.
Still ISEMPTY function is returning 'False' and COUNTROWS returning 9 records.

 

Expected outcome is ISEMPTY should return TRUE. What am I missing here?

1 ACCEPTED SOLUTION

Yes, you are right. After posting this query, I noticed that there are 9 records having blank in project manager email. Which matches the outcome of COUNTROWS function.

 

I was able to get around this issue by modifying the measure as below:

LoggedInUserIsPm =

VAR CurrentUser = USERPRINCIPALNAME()

 

VAR LoggedInUserEmail =
DISTINCT(SELECTCOLUMNS(
FILTER(PM_Table, PM_Table[EMPLOYEE_USER_PRINCIPAL_NAME] = CurrentUser), "EMPLOYEE_E_MAIL", [EMPLOYEE_E_MAIL]))


VAR IsPm = IF(ISBLANK(LoggedInUserEmail), 0, NOT(ISEMPTY(CALCULATETABLE(ReportTable, ReportTable[project_manager_email] = LoggedInUserEmail )))

 

Return
1 * IsPm

Thanks for your inputs.

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

do you have any records where the project manager email is blank?

Yes, you are right. After posting this query, I noticed that there are 9 records having blank in project manager email. Which matches the outcome of COUNTROWS function.

 

I was able to get around this issue by modifying the measure as below:

LoggedInUserIsPm =

VAR CurrentUser = USERPRINCIPALNAME()

 

VAR LoggedInUserEmail =
DISTINCT(SELECTCOLUMNS(
FILTER(PM_Table, PM_Table[EMPLOYEE_USER_PRINCIPAL_NAME] = CurrentUser), "EMPLOYEE_E_MAIL", [EMPLOYEE_E_MAIL]))


VAR IsPm = IF(ISBLANK(LoggedInUserEmail), 0, NOT(ISEMPTY(CALCULATETABLE(ReportTable, ReportTable[project_manager_email] = LoggedInUserEmail )))

 

Return
1 * IsPm

Thanks for your inputs.

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.