Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
adam_macs
Helper I
Helper I

Subgroup analysis returning TRUE when Blank

Hi all, I have created a column that looks up the Customer Group column and returns true/false if any customer within that group has purchased (even if only one or two purchased). 

 

My formula seems to work fine apart from it returning TRUE when the Group column is Blank (it is definitely blank, I tried Trimming and Cleaning it in Query Editor). This column has to remain blank also. 

 

I would like it to return FALSE if that column is blank. Any ideas?

 

IsGroupCustomer = 
VAR _min =
CALCULATE (
COUNTROWS(FILTER('table', 'table'[Purchase])),
FILTER (
'table',
'table'[Customer Group] = EARLIER('table'[Customer Group])
&& NOT(ISBLANK('table'[Customer Group]))
)
)
RETURN
IF (ISBLANK('table'[Customer Group]), FALSE(), IF ( _min > 0, TRUE(), FALSE()))

 

adam_macs_1-1680174304153.png

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

this shall also work:

IsGroupCustomer = 
VAR _condition1 =
COUNTROWS(
    FILTER(
        TableName,
        TableName[Customer Group] = EARLIER(TableName[Customer Group])
            &&TableName[Purchase]
    )
)>=1
VAR _condition2 =
TableName[Customer Group]<>BLANK()
RETURN
IF(
    _condition1&&_condition2,
    TRUE, FALSE
)

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

this shall also work:

IsGroupCustomer = 
VAR _condition1 =
COUNTROWS(
    FILTER(
        TableName,
        TableName[Customer Group] = EARLIER(TableName[Customer Group])
            &&TableName[Purchase]
    )
)>=1
VAR _condition2 =
TableName[Customer Group]<>BLANK()
RETURN
IF(
    _condition1&&_condition2,
    TRUE, FALSE
)

That worked a treat, thanks very much!

FreemanZ
Super User
Super User

hi @adam_macs 

try like:

IsGroupCustomer = 
VAR _condition1 =
COUNTROWS(
    FILTER(
        TableName,
        TableName[Customer Group] = EARLIER(TableName[Customer Group])
            &&TableName[Purchase]=TRUE
    )
)>=1
VAR _condition2 =
TableName[Customer Group]<>BLANK()
RETURN
IF(
    _condition1&&_condition2,
    TRUE, FALSE
)

 

FreemanZ_0-1680181215713.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors