Forum Discussion

Fcoatis's avatar
Fcoatis
Post Patron
6 years ago

Contains

Hello everyone,

 

I need some help here: Two tables one virtual the other phisical. The virtual returns 18 names and the phisical 35 names I would lke to return A table with all 35 names and true or false if these names appears in the virtual one

 

DEFINE
VAR T1 =
 DISTINCT(
    SELECTCOLUMNS(
        CALCULATETABLE(
            Arbitragem,
            Arbitragem[Função]="Arbitro",
            Arbitragem[Rodada]>= 12 &&
            Arbitragem[Rodada]<=13
        ),
        "Arbitro", Arbitragem[Nome Oficial]
    )
)

VAR T2 =
DISTINCT(Arbitros[Arbitro])

Please find sample here

 

Thanks in advance

 

 

10 Replies

  • Hi, I don't quite understand if you just want to check data or build a measure. Anyway, this code will return you a table with the names and the new column.

     

    If the tables are related you can write this code:

    EVALUATE
    ADDCOLUMNS(
    	SUMMARIZE( 'Phisical', ' Phisical'[Name] ),
    	"NewColumnName",
    	IF(
    		COUNTROWS(RELATEDTABLE( 'Virtual' )) > 0,
    		"True",
    		"False"
    	)
    )

    If the tables are not related, something like this should work:

    EVALUATE
    ADDCOLUMNS(
    	SUMMARIZE( 'Phisical', 'Phisical'[name] ),
    	"NewColumnName",
    	IF(
    		'Phisical'[name] IN VALUES ( 'Virtual'[name] ),
    		"True",
    		"False"
    	)
    )

    Hope this helps

     

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

    • Fcoatis's avatar
      Fcoatis
      Post Patron

      Thank you ibarrau for spending time with this.

       

      Did you check the sample file? Heres what I´m Trying to do.

       

      Test = 
      VAR currArbitro = SELECTEDVALUE(Table1[Arbitro])
      
      VAR T1 =
       DISTINCT(
          SELECTCOLUMNS(
              CALCULATETABLE(
                  Table1,
                  Table1[Rodada]>= 12 &&
                  Table1[Rodada]<=13
              ),
              "Arbitro", Table1[Arbitro]
          )
      )
      
      VAR T2 = DISTINCT(Arbitros[Arbitro])
      
      RETURN
      CONTAINS(t1,[Arbitro],currArbitro)

      Can you acomplish in the sample file? Thank you in advance

      • ibarrau's avatar
        ibarrau
        Super User

        I tried to open the file but the link required permission to access.

         

        The second post you are clarifying the return and it looks like a calculated column. If you want a calculated column just add the "IF" code from my previous post and ignore the rest. The if code is the exact calculated column. Like this

        	IF(
        		'Phisical'[name] IN VALUES ( 'Virtual'[name] ),
        		"True",
        		"False"
        	)

         

        Hope this help