Forum Discussion
apelleti
3 years agoHelper I
DAX expression question
Hi everyone,
I'm looking for a DAX forumla that will return the column below "Significant Line". If a line contains at least one significant segment (Significant Segment = Yes), then each entry for that line is assigned "Yes" in the column "Significant line".
I tried the formula below which works as a measure, but does not work directly in the table (i.e when clicking "new column" in the table view).
SignificantLine = MAXX(FILTER(ALL('Table'),'Table'[Line]=SELECTEDVALUE('Table'[Line])),'Table'[SignificantSegment)
Thanks in advance!
| Line | Segment | Significant Segment | Significant Line |
| 1 | 1 | Yes | Yes |
| 1 | 2 | No | Yes |
| 1 | 3 | No | Yes |
| 1 | 4 | No | Yes |
| 2 | 5 | Yes | Yes |
| 2 | 6 | Yes | Yes |
| 2 | 7 | Yes | Yes |
| 2 | 8 | Yes | Yes |
| 3 | 9 | No | No |
| 3 | 10 | No | No |
| 4 | 11 | Yes | Yes |
| 4 | 12 | No | Yes |
| 4 | 13 | Yes | Yes |
Update like this:
Column =VAR _line = TableName[Line]VAR SigSeg =CALCULATE(MAX(TableName[Significant Segment]),TableName[Line] = _line,ALL())RETURNIF(SigSeg="Yes", "Yes", "No")tried and it worked like this:
8 Replies
- tamerj1Community Champion
Hi apelleti
you can also use
SignificantLine =
IF (
"Yes"
IN CALCULATETABLE (
VALUES ( 'Table'[SignificantSegment] ),
ALLEXCEPT ( 'Table', 'Table'[Line] )
),
"Yes",
"No"
)or
SignificantLine =
IF (
COUNTROWS (
CALCULATETABLE (
VALUES ( 'Table'[SignificantSegment] ),
ALLEXCEPT ( 'Table', 'Table'[Line] )
)
) > 1,
"Yes",
"No"
)