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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
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.