cancel
Showing results for
Did you mean:

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

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

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
Community Support

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:

``````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:

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

Best Regards,

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

Community Support

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:

``````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:

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

Best Regards,

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

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors