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

check vaules

Hi Everyone,

I need Help,

 

I want to Create Calculate colmun in table 1 with name message  to show Text Message after check value in others table, based on below tables 

table 1
idmessage 
1in table 3
2in table 2
3in table 2
4in table 3
5in table 4
6in table 4
7in table 4

 

table 2
id 
2 
3 

  

table 3
id 
4 
5 
1 
table 4
id 
5 
6 
7 


Thnaks Advance 





1 ACCEPTED SOLUTION
Anonymous
Not applicable

Why is 5 in table 4, but not table 3? Is there any priority? You may try something like this, I think.. 

= SWITCH( TRUE(), 
COUNTROWS( FILTER( Table2,
Table2[id] = Table1[id])) > 0, "in table2",
COUNTROWS( FILTER( Table3,
Table3[id] = Table1[id])) > 0, "in table3",
...
BLANK())

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Why is 5 in table 4, but not table 3? Is there any priority? You may try something like this, I think.. 

= SWITCH( TRUE(), 
COUNTROWS( FILTER( Table2,
Table2[id] = Table1[id])) > 0, "in table2",
COUNTROWS( FILTER( Table3,
Table3[id] = Table1[id])) > 0, "in table3",
...
BLANK())
Anonymous
Not applicable

thanks @Anonymous  for  your replay,

 

but when I write equality

Table2[id] = Table1[id]

 the Table1[id] sentence show error or not defined, can you tell me about how  the  relation must be done between table1, table2, table3 and table 4

Anonymous
Not applicable

hi ,

There is no need to add relationships. Please check the names as AIB suggested.

Anonymous
Not applicable

thanks @Anonymous , @AlB 

I Not use names that mention it   here, I use the table  just to explain the case
you can see below image to more details, maybe after = sign must be an expression or a column name.

staaf1.JPG

 

Anonymous
Not applicable

@Anonymous , @AlB 

IT'S  WORK WITH ME, BUT I WANT TO STORE ONE VALUE  IF THE CONDITION IS  TRUE
PLEASE CHECK  BELOW  DAX FORMAL

-----

Message =

 

SWITCH( TRUE(),
COUNTROWS( FILTER( 'test Staff',
'test Staff'[IDENTIFICATIONNUMBER] = ReasonsNotReg[id])) > 0, " Staff",

COUNTROWS( FILTER( ReasonsNotReg,
ReasonsNotReg[line] = BLANK()


)) > 0, "Havn't Line",
COUNTROWS(FILTER( ReasonsNotReg,
ReasonsNotReg[number] = "x-0002987" || ReasonsNotReg[number] = "x-0032987"

|| ReasonsNotReg[number] = "x-030502987"

|| ReasonsNotReg[number] = "x-00022987"

|| ReasonsNotReg[number] = "x-04002987"



) ) > 0, "Worker",


COUNTROWS( FILTER( ReasonsNotReg,
ReasonsNotReg[main st] = BLANK()

)) > 0, "Not Have STATUSE",


COUNTROWS( FILTER( ReasonsNotReg,
ReasonsNotReg[start] = BLANK()

)) > 0, "not start",



BLANK())

Anonymous
Not applicable

If you didn't get what you want, please let us know your expected result.
Anonymous
Not applicable

hi @Anonymous , 

your formal it's ok,  but I want to apply on more than 5 options because  I have 7 messages must be shown as results, so your formal just show the first two message for all table records.

I want to help me how I can Add more options,
I will write it using if statement and you help me to convert it to DAX

Message =

if (value1 from table1 = value from table 2)
message = " message 1"

else if (value1 from table1 = value from table3)
message = " message 2"

else if (value1 from table1 = value from table4)
message = " message 3"

else if (value2 from table1 = "hello ")
message = " message 4"

else if (value3 from table1 = 5)
message = " message 5"

else
" no message"

 

 

 

----------------

thanks advance for  your help  🙂

Anonymous
Not applicable

@AlB  can you help me for  this  topic 

thanks advance 

Hi @Anonymous 

@Anonymous 's solution looks good to me. Are you sure you are entering it correctly? If you're getting an error that something is undefined, do check the names of the tables are the correct ones: 'table 2' vs 'table2' etc.

Cheers

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.