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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
merlingsf
Frequent Visitor

Max value from two columns - Show blanks

Hi,

 

I am having trouble geting a single max value for a row from three columns in a matrix.

 

The columns are: Name, Date(Month), Price

The Dataset:

 

NameMonthPrice
AJanuary75.000
AJanuary150.000
AMarch250.000
BJanuary350.000
BJanuary175.000
BMarch150.000
CMarch75.000
CMarch65.000
CJanuary125.000

 

A simple Max() Formula will result in:

NameJanuaryMarchTotal (Max)
A150.000250.000250.000
B350.000150.000350.000
C125.00075.000125.000
Total (Max)350.000250.000 

 

What I am aiming for:

NameJanuaryMarchTotal (Max)
A 250.000250.000
B350.000 350.000
C   
Total (Max)350.000250.000 

 

So, it should show a blank when the the Max value is not valid in this context. C does not have the max price in either January or March hence blank.

 

Any suggestions?

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

Hi @merlingsf ,

 

We can try to create a measure to meet your requirement:

 

Measure =
SUMX (
    DISTINCT ( 'Table'[Month] ),
    VAR result =
        MAXX (
            CALCULATETABLE ( DISTINCT ( 'Table'[Name] ), ALLSELECTED () ),
            CALCULATE ( MAX ( 'Table'[Price] ) )
        )
    RETURN
        IF ( CALCULATE ( MAX ( 'Table'[Price] ) ) = result, result, BLANK () )
)

 

1.jpg

 


By the way, PBIX file as attached.


Best regards,

 

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

2 REPLIES 2
v-lid-msft
Community Support
Community Support

Hi @merlingsf ,

 

We can try to create a measure to meet your requirement:

 

Measure =
SUMX (
    DISTINCT ( 'Table'[Month] ),
    VAR result =
        MAXX (
            CALCULATETABLE ( DISTINCT ( 'Table'[Name] ), ALLSELECTED () ),
            CALCULATE ( MAX ( 'Table'[Price] ) )
        )
    RETURN
        IF ( CALCULATE ( MAX ( 'Table'[Price] ) ) = result, result, BLANK () )
)

 

1.jpg

 


By the way, PBIX file as attached.


Best regards,

 

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

Hi @v-lid-msft,

 

Thank you so much for taking the time to look at this.

 

This seems to solve the problem.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.