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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
RenanVentura
New Member

DAX, get the maximum value of the value of each quote

Hi everyone!
I'm having a issue to solve this problem.

I need the max Value of the quote for each item, and at the end i need the sum of the highest values
For Example

RenanVentura_3-1712850358987.png

 

 

The max value of code 4, item 473 is $48,000.00

The max value of code 4, item 914 is $13,920.00

The max value of code 4, item 2599 is $13,886.40

The max value of code 4, item 2853 is $14,250.00

The max value of code 4, item 2854 is $20,000.00
The max value of code 4, item 2855 is $32,100.00

And the total value of the quote would be $142,156.40


1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RenanVentura ,

Depending on the information you have provided, there seems to be some problems with the logic of the calculations you gave, which I have corrected. You can follow these steps below:

1.Add an index column.

vyifanwmsft_0-1712887062000.png

2.Add new measure.

MAX = 
VAR _CODQUOTE =
    SELECTEDVALUE ( 'Table'[Cod-Quote] )
VAR _CODPRODUCT =
    SELECTEDVALUE ( 'Table'[Cod_product] )
VAR _RANK =
    RANKX (
        FILTER (
            'Table',
            'Table'[Cod-Quote] = _CODQUOTE
                && 'Table'[Cod_product] = _CODPRODUCT
        ),
        CALCULATE ( MAX ( 'Table'[TOTAL VALUE] ) ),
        ,
        DESC
    )
RETURN
    CALCULATE ( SUM ( 'Table'[TOTAL VALUE] ), FILTER ( 'Table', _RANK = 1 ) )

Final output:

vyifanwmsft_1-1712887121393.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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
Anonymous
Not applicable

Hi @RenanVentura ,

Depending on the information you have provided, there seems to be some problems with the logic of the calculations you gave, which I have corrected. You can follow these steps below:

1.Add an index column.

vyifanwmsft_0-1712887062000.png

2.Add new measure.

MAX = 
VAR _CODQUOTE =
    SELECTEDVALUE ( 'Table'[Cod-Quote] )
VAR _CODPRODUCT =
    SELECTEDVALUE ( 'Table'[Cod_product] )
VAR _RANK =
    RANKX (
        FILTER (
            'Table',
            'Table'[Cod-Quote] = _CODQUOTE
                && 'Table'[Cod_product] = _CODPRODUCT
        ),
        CALCULATE ( MAX ( 'Table'[TOTAL VALUE] ) ),
        ,
        DESC
    )
RETURN
    CALCULATE ( SUM ( 'Table'[TOTAL VALUE] ), FILTER ( 'Table', _RANK = 1 ) )

Final output:

vyifanwmsft_1-1712887121393.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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