Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
apelleti
Helper I
Helper 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!

 

LineSegmentSignificant SegmentSignificant Line
11YesYes
12NoYes
13NoYes
14NoYes
25YesYes
26YesYes
27YesYes
28YesYes
39NoNo
310NoNo
411YesYes
412NoYes
413YesYes
1 ACCEPTED SOLUTION

Update like this:

Column =
VAR _line = TableName[Line]
VAR SigSeg =
CALCULATE(
    MAX(TableName[Significant Segment]),
    TableName[Line] = _line,
    ALL()
)
RETURN
IF(SigSeg="Yes", "Yes", "No")
 
tried and it worked like this:
FreemanZ_0-1670899026340.png

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

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"
)

FreemanZ
Super User
Super User

hi @apelleti 

For calculated column, try like:

Significant Line =

VAR _line = [Line]

VAR SigSeg = 

CALCULATE(

     MAX([Significant Segment]),

     [Line] = _line

)

RETURN

IF(SigSeg="Yes", "Yes", "No")

Update like this:

Column =
VAR _line = TableName[Line]
VAR SigSeg =
CALCULATE(
    MAX(TableName[Significant Segment]),
    TableName[Line] = _line,
    ALL()
)
RETURN
IF(SigSeg="Yes", "Yes", "No")
 
tried and it worked like this:
FreemanZ_0-1670899026340.png

@FreemanZ like a charm! Thank you!!

hi @apelleti 

 

it works because Y is after N alphabetically.

this shall also work:

Column2 =

VAR _line = TableName[Line]

VAR SigSeg =

MAXX(

    FILTER(TableName, TableName[Line] = _line)

    TableName[Significant Segment])

)

RETURN

IF(SigSeg="Yes", "Yes", "No")

Hi @FreemanZ 

 

How would I do it if, instead of just "Yes" and "No", there were 4 text options representing different ranks of risk, and the text of interest is not alphabetically the min or max? For example, if the "Significant" column contained either "Not present", "Weak", "Moderate" or "Strong" and I wanted to assign all values the "worst" possible outcome present in the line? for this example, the "best" outcome would be "not present" and the "worst" would be "strong". So if one segment in the line includes "strong", all values would be assigned "strong". If "strong" is not present, it would move to "moderate" (if present) and so on. 

 

Thank you!

hi @apelleti 

1) that could be several nested ifs, comparing one after another.

2) Or it would also be advisible to encode strong/moderate/not present/worst as 1/2/3/4, by introducing another dimtable with only two columns, one consists strong/moderate/not present/worst and the other 1/2/3/4. Then MINX/MAXX could be used on the 1/2/3/4 column.

@FreemanZ 

 

That makes sense. I'm really glad you gave this explanation because I need to repeat the function for fields that use different booleans (not just "Yes" and "No").

 

Thanks again for your help!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.