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
Anonymous
Not applicable

DISTINCT excluding blanks and "Cancelled" transactions

So I have my dataset with Client ID, Date, Status, Amount and a lot of extra columns.

 

I wanted to segment the clients using an RFM method, so I created a new Table and used the DISTINCT formula to extract all the distinct client IDs but I'm having a problem with 2 conditions. The first one is that there are some clients that don't have an ID so I want them excluded from my table, so I used this formula to successfully exclude the blanks: 

 

Data RF= (distinct(filter(values('VTEX 2018-2019'[Client ID]);LEN('VTEX 2018-2019'[Client ID])>0)))


But the other condition is that there are some clients that only have "Cancelled" transactions, this is shown in the Status column.

 

My question is how can I create a Measure that only brings to my new table the customer IDs that are not blanks and that are not "Cancelled"
 
Thank you all
 
William
1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

Hi,  

You can add CALCULATETABLE to your formula, it can be something like the following:

Data RF =

    DISTINCT (

        CALCULATETABLE (

            FILTER ( VALUES ( 'VTEX 2018-2019'[Client ID] ), LEN ( 'VTEX 2018-2019'[Client ID] ) > 0),

            FILTER ( 'VTEX 2018-2019', [Status] <> "Cancelled" ),

            'VTEX 2018-2019'[Customer ID] <> BLANK () ) )

Best, 
Paul

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

Hi,  

You can add CALCULATETABLE to your formula, it can be something like the following:

Data RF =

    DISTINCT (

        CALCULATETABLE (

            FILTER ( VALUES ( 'VTEX 2018-2019'[Client ID] ), LEN ( 'VTEX 2018-2019'[Client ID] ) > 0),

            FILTER ( 'VTEX 2018-2019', [Status] <> "Cancelled" ),

            'VTEX 2018-2019'[Customer ID] <> BLANK () ) )

Best, 
Paul

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you! That did it!!!

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.