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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.