cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gwaczoka23
Frequent Visitor

How to extract max value within group of product (with measure)

Hi,

can someone please help write a measure which could help me achieve the result from the last column?
I'd like to have only one value for each group of products (for product A I want only 500 in one row)

 

I have a lot more (less needed here) columns in this table, which expected measure should not take into account

 

Productsalesdateavg priceavg price2
A01.01.2022500500
A02.01.2022500 
A03.01.2022500 
A04.01.2022500 
A05.01.2022500 
A06.01.2022500 
B01.01.2022888888
B02.01.2022888 
B03.01.2022888 
B04.01.2022888 
B05.01.2022888 
B06.01.2022888 
1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @gwaczoka23 ,

 

Please create a measure:

 

Measure = 
MAXX (
    'Table',
    IF (
        'Table'[salesdate]
            = MINX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Product] = SELECTEDVALUE ( 'Table'[Product] )
                ),
                'Table'[salesdate]
            ),
        'Table'[avg price]
    )
)

 

 

The result you want:

vyadongfmsft_0-1669777400032.png

 

Remember to select "show items with no data":

vyadongfmsft_1-1669777480906.png

 

Best regards,

Yadong Fang

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

1 REPLY 1
v-yadongf-msft
Community Support
Community Support

Hi @gwaczoka23 ,

 

Please create a measure:

 

Measure = 
MAXX (
    'Table',
    IF (
        'Table'[salesdate]
            = MINX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Product] = SELECTEDVALUE ( 'Table'[Product] )
                ),
                'Table'[salesdate]
            ),
        'Table'[avg price]
    )
)

 

 

The result you want:

vyadongfmsft_0-1669777400032.png

 

Remember to select "show items with no data":

vyadongfmsft_1-1669777480906.png

 

Best regards,

Yadong Fang

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

Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!