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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
_Regina
Helper I
Helper I

ALL function not behaving as expected

Hi everyone,

 

I have the following measure. What I am trying to do here is get the number of distinct 'onboarding ids' where there is a transaction.

 

Onboarding ID is in a fact table named 'Onbaording requests', transactions are in a fact table name 'Sales transactions'. Both these tables have a common column 'ACCOUNT_DIM_SYSID'.

 

Both the fact tables have relation with 'Date' table.

'Onbaording requests'[start date] to Date[Date]

'Sales transactions'[transaction dtae] to to Date[Date]

 

I have used NATURALINNERJOIN to obtain the result. The only thing is that I don't want the date slicer to affect Sales transactions, it should only affect 'Onboarding requests' table. I have a date slicer on my report page which is based on Dtae table.

 

For ex:

If I choose June 2023, It should give me all 'onboarding id' that have start date in June 2023 and have an associated transaction, even if the transaction occured outside of June 2023. 

 

I have used ALL function in my variable b., but it still giving me all onboarding id where start date is in June 2023 as well as Transaction Dtae is in June 2023.

 

_test =
VAR a =
       SELECTCOLUMNS (
                'Onboarding Requests',
                "ACCOUNT_DIM_SYSID", 'Onboarding Requests'[ACCOUNT_SYSID] + 0,
                "onboarding_id", 'Onboarding Requests'[ONBOARDING_ID]
         )
VAR b =
      SELECTCOLUMNS (
             FILTER (
                    ALL ( 'Sales Transactions'[ACCOUNT_DIM_SYSID] ),
                   [_Product Net Sales Buy Sell Transaction Count] > 0
             ),
            "ACCOUNT_DIM_SYSID", 'Sales Transactions'[ACCOUNT_DIM_SYSID] + 0
       )
VAR R =
             NATURALINNERJOIN ( a, b )
VAR result =
             COUNTROWS ( SUMMARIZE ( R, [onboarding_id] ) )
RETURN
           result

 

Any guidance here is appreciated. @amitchandak @AlexisOlson 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The measure [_Product Net Sales Buy Sell Transaction Count] still has the date filter context active.

 

Maybe removing the date filtering in the definition of b will help.

VAR b =
    SELECTCOLUMNS (
        CALCULATETABLE (
            FILTER (
                ALL ( 'Sales Transactions'[ACCOUNT_DIM_SYSID] ),
                [_Product Net Sales Buy Sell Transaction Count] > 0
            ),
            ALL ( 'Date' )
        ),
        "ACCOUNT_DIM_SYSID", 'Sales Transactions'[ACCOUNT_DIM_SYSID] + 0
    )

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

The measure [_Product Net Sales Buy Sell Transaction Count] still has the date filter context active.

 

Maybe removing the date filtering in the definition of b will help.

VAR b =
    SELECTCOLUMNS (
        CALCULATETABLE (
            FILTER (
                ALL ( 'Sales Transactions'[ACCOUNT_DIM_SYSID] ),
                [_Product Net Sales Buy Sell Transaction Count] > 0
            ),
            ALL ( 'Date' )
        ),
        "ACCOUNT_DIM_SYSID", 'Sales Transactions'[ACCOUNT_DIM_SYSID] + 0
    )

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.