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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Syndicate_Admin
Administrator
Administrator

Maximum value of a column

Hello

I'd like to know how to see the last value of one column filtering by others. I paste sample table.

Before:

ID0ID1 Question Answer
8AAAVTUHJ A0
7AAAVTUHJ A0
6AAAVTUHJ A1
5AAAVTUHJ B1
4AAAVTUHJ B1
3AAAVTUHJ B1
2AAAVTUHJ C1
1AAAVTUHJ C0

After:

ID0ID1 Question Answer NewColumn
8AAAVTUHJ A00
7AAAVTUHJ A0
6AAAVTUHJ A1
5AAAVTUHJ B11
4AAAVTUHJ B1
3AAAVTUHJ B1
2AAAVTUHJ C11
1AAAVTUHJ C0

Greetings and thanks in advance,

Xavi

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Please refer to the formulas.

//If you want a measure
Measure 4 = 
VAR x = 
MAXX(
    FILTER( ALL(Sheet7), [ID1] = MAX([ID1]) && [Question] = MAX([Question]) ),
    [ID0]
)
RETURN
CALCULATE(
    MAX(Sheet7[Answer]),
    FILTER(
        Sheet7,
        Sheet7[ID0] = x
    )
)

v-lionel-msft_0-1613537312751.png

If you want a calculated column.

// If you want a column
Column = 
VAR x = 
MAXX( 
    FILTER( Sheet7, [ID1] = EARLIER([ID1]) && [Question] = EARLIER(Sheet7[Question]) ),
    [ID0]
)
RETURN
IF(
    [ID0] = x,
    [Answer], BLANK()
)

v-lionel-msft_1-1613537488244.png

 

Best regards,
Lionel Chen

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

 

View solution in original post

7 REPLIES 7
v-lionel-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Please refer to the formulas.

//If you want a measure
Measure 4 = 
VAR x = 
MAXX(
    FILTER( ALL(Sheet7), [ID1] = MAX([ID1]) && [Question] = MAX([Question]) ),
    [ID0]
)
RETURN
CALCULATE(
    MAX(Sheet7[Answer]),
    FILTER(
        Sheet7,
        Sheet7[ID0] = x
    )
)

v-lionel-msft_0-1613537312751.png

If you want a calculated column.

// If you want a column
Column = 
VAR x = 
MAXX( 
    FILTER( Sheet7, [ID1] = EARLIER([ID1]) && [Question] = EARLIER(Sheet7[Question]) ),
    [ID0]
)
RETURN
IF(
    [ID0] = x,
    [Answer], BLANK()
)

v-lionel-msft_1-1613537488244.png

 

Best regards,
Lionel Chen

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

 

Pragati11
Super User
Super User

Hi @Syndicate_Admin ,

 

Create the followng calculated column as follows:

Output =
var t2 = CALCULATE(MAX('ID Data'[ID0]), FILTER(ALLSELECTED('ID Data'), 'ID Data'[ID1] = EARLIER('ID Data'[ID1])))
var t1 = CALCULATE(FIRSTNONBLANK('ID Data'[Question Answer], TRUE()), FILTER(ALLSELECTED('ID Data'), 'ID Data'[ID1] = EARLIER('ID Data'[ID1]) && 'ID Data'[ID0] = t2))
RETURN
IF('ID Data'[ID0] = t2, t1, BLANK())
 
Now move this to your table visual and you get the expected result:
t1.PNG
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hello

When I apply this formula the result is as follows:

22121.png



For example, values 1 do not appear in the Output column

The formula is as follows (the table is called Label Oil)

Departure .
var t2 = CALCULATE(MAX('AceiteGráfica'[Id]), FILTER(ALLSELECTED('AceiteGráfica'), 'AceiteGráfica'[ExecutionReference] = EARLIER('AceiteGráfica'[ExecutionReference])))
var t1 = CALCULATE(FIRSTNONBLANK('AceiteGráfica'[Name], TRUE()), FILTER(ALLSELECTED('AceiteGráfica'), 'AceiteGráfica'[ExecutionReference] = EARLIER('AceiteGráfica'[ExecutionReference]) && 'AceiteGráfica'[Id] = t2))
RETURN
IF('AceiteGráfica'[Id] = t2, t1, BLANK())

Hi,

Question and Answer are a different columns.

Hi @Syndicate_Admin ,

 

Ok they are different columns I understand. But the output is right based on the requireemnt.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@Syndicate_Admin , Create a new column

 

new column =
var _1 = countx(filter(Table, [ID1] =earlier[ID1] && [Answer] =0),[ID1])+0
var _2 = MinX(filter(Table, [ID1] =earlier[ID1] ),[ID0])
return
if([ID0] =_2 ,if(_1>0 0, 1),blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

When you writte "á" "?", what does a mean?

Regards,

Xavi

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors