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.
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 | |
id | message |
1 | in table 3 |
2 | in table 2 |
3 | in table 2 |
4 | in table 3 |
5 | in table 4 |
6 | in table 4 |
7 | in table 4 |
table 2 | |
id | |
2 | |
3 |
table 3 | |
id | |
4 | |
5 | |
1 |
table 4 | |
id | |
5 | |
6 | |
7 |
Thnaks Advance
Solved! Go to Solution.
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())
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())
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
hi mohammed,
There is no need to add relationships. Please check the names as AIB suggested.
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.
@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())
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 🙂
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |