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
mhsk
Helper II
Helper II

Obtain single value from column with max values into a new column

Easy question:

 

how to get just a single value from sumQty_by_item column?

 

locationpartqtysum_qty_by_itemdateexpected result
1111106001.05.201960
2111206001.05.20190
3111306001.05.20190
12225901.05.20199
22221901.05.20190
32223901.05.20190
111152502.05.201925
211162502.05.20190
311172502.05.20190
411172502.05.20190

 

is it even possible with dax? i need it in new column as im using it in chart/as slicer etc.

1 ACCEPTED SOLUTION

Hi @mhsk 

I would suggest you to add an index column in query editor.Then create the column as below:

Column =
VAR pre_sum =
    CALCULATE (
        MAX ( 'Table'[sum] ),
        FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
    )
RETURN
    IF (
        pre_sum <> 'Table'[sum],
        CALCULATE ( MAX ( 'Table'[sum] ), ALLEXCEPT ( 'Table', 'Table'[sum] ) ),
        0
    )

1.png

Regards,

Community Support Team _ Cherie 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

5 REPLIES 5
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @mhsk 

You may try below dax.

Column =
IF (
    [location] = 1,
    CALCULATE (
        MAX ( [sum_qty_by_item] ),
        ALLEXCEPT ( 'Table', 'Table'[sum_qty_by_item] )
    ),
    0
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks for a prompt reply, the thing is I don't want to connect it anyhow to location imagine my table looks:

 

part sumexpected result
1115050
111500
111500
2226060
222600
222600
33311
33310
33310
4441010
444100
444100

Hi @mhsk 

I would suggest you to add an index column in query editor.Then create the column as below:

Column =
VAR pre_sum =
    CALCULATE (
        MAX ( 'Table'[sum] ),
        FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
    )
RETURN
    IF (
        pre_sum <> 'Table'[sum],
        CALCULATE ( MAX ( 'Table'[sum] ), ALLEXCEPT ( 'Table', 'Table'[sum] ) ),
        0
    )

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ok this works while parts are always represented in multiple rows, but there are also cases where part can have just one row (no index-1 possible) - like part 555 below, could you have a look ?

part sumexpected result
1115050
111500
111500
2226060
222600
222600
33311
33310
33310
4441010
444100
444100
5551515

Hi @mhsk 

The above workaround could work for your scenario.

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

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