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
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
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.