+ Reply to Thread
Results 1 to 2 of 2

DAX CONTAINS and CONTAINSROW

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    777

    DAX CONTAINS and CONTAINSROW

    I have a question re the diffference between the two , in the following boht return true or false

    EVALUATE
    ADDCOLUMNS (
        Table1,
        "N", CALCULATE ( CONTAINS ( Table1, Table1[Customer], "Tom" ) ),
        "M", CONTAINSROW ( {"Tom" }, Table1[Customer] )
    )
    But when the above are used for measures, Containsrow needs to be re written;

    CONTAINSROW( VALUES( Table1[Customer]), "Tom")
    or
    CONTAINSROW( {"Tom"},IF( HASONEVALUE( Table1[Customer]),VALUES(Table1[Customer])) )

    but if used inside a measure it can use the same order as the calculated column, such as ;

    CALCULATE( [TotalUnits], KEEPFILTERS( CONTAINSROW( {"Tom"}, Table1[Customer] )  ))
    Containsrow can be used as it was for a calculated column, could someone explain or point me in direction of some information
    on how this is calculated, not MS Docs.
    Ive attached the above examples.

    Richard.
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: DAX CONTAINS and CONTAINSROW

    CONTAINSROW expects a table as the first argument and a single value as the second argument. (it's complete overkill in your calculated column)

    Think about the context of using it in a measure, and you should understand.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] DAX CONTAINS and CONTAINSROW
    By Dicken in forum Office 365
    Replies: 3
    Last Post: 09-30-2023, 05:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1