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

IF statement

Hi

 

I would like to determine if a particular customer has been active in the last quarter. I have all sales in a column called difference but can't seem to find the right IF statement to return the "ACTIVE" or "INACTIVE" status.

So if the customer's difference is zero or below I would like them to be "INACTIVE" and the reverse if they have purchased.

The idea is that a sales executive can quickly see all their customer who have been inactive over the past quarter.

 

Thanks in anticipation.

 

 

1 ACCEPTED SOLUTION
Qualube
Helper II
Helper II

Managed to solve it after looking extensively on the web with a new measure:

 

InactiveCustomers = CALCULATE( COUNTROWS( 'Customer List Table' ), FILTER( ALL('Customer List Table'[Difference]), 'Customer List Table'[Difference] <= 0 ))

 

Thanks for the help anyway

View solution in original post

5 REPLIES 5
Qualube
Helper II
Helper II

Managed to solve it after looking extensively on the web with a new measure:

 

InactiveCustomers = CALCULATE( COUNTROWS( 'Customer List Table' ), FILTER( ALL('Customer List Table'[Difference]), 'Customer List Table'[Difference] <= 0 ))

 

Thanks for the help anyway

Anonymous
Not applicable

Hi @Qualube,

 

Do you want to this in DAX or in Power Query?

 

In Power Query:

if [difference]<=0 then "INACTIVE" else "ACTIVE"

 

In DAX:

IF(table[difference]<=0, "INACTIVE", "ACTIVE")

 

Br,

T

 

Hi T

 

The problem is I get this error message:

 

ERROR.JPG

 

 

Is Difference a calculated column or a measure?

Hi Caitlin

 

It's a measure as what I need to do is filter through the [difference] column and return the number of customers with zero or negative sales over a quarter.

I have looked extensively and I think SUMX is the expression I need to use but I can't make it work.

 

Thanks

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.