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
tonvhemert3
Regular Visitor

Using MIN/MAX function in measure, but the total doesn't add up as expected.

Hi,

 

I am currently facing an issue where my values don't add up as expected. I have a table with different ratio's per country, called Verhoudingsgetallen. Let's say:

 

CountrySolarVerhouding
US0,00194
NZ0,02944
DE0,03948
NL0,04854

 

The measure I use is as following: 

 

DemandSolars =
VAR SolarVerhouding_ =
    MAX ( Verhoudingsgetallen[SolarVerhouding] )
VAR SensorForecast_ =
    SUM ( 'Salesforce budgetForecasts'[Forecast__c] )
RETURN
    SolarVerhouding_ * SensorForecast_
 
I use the MAX function, because I want to have the specific value for the specific country used in my rows. The value I get per country is the correct one, but the total value is incorrect, since it uses the MAX SolarVerhouding number times the Forecast. However, I want the SUM of the individuals rows displayed as total. What can I do?
 
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

 

DemandSolars =
SUMX (
    VALUES ( 'Table'[Country] ),
    VAR SolarVerhouding_ =
        CALCULATE(MAX ( Verhoudingsgetallen[SolarVerhouding] ))
    VAR SensorForecast_ =
        CALCULATE(SUM ( 'Salesforce budgetForecasts'[Forecast__c] ))
    RETURN
        SolarVerhouding_ * SensorForecast_
)

 

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Try

 

DemandSolars =
SUMX (
    VALUES ( 'Table'[Country] ),
    VAR SolarVerhouding_ =
        CALCULATE(MAX ( Verhoudingsgetallen[SolarVerhouding] ))
    VAR SensorForecast_ =
        CALCULATE(SUM ( 'Salesforce budgetForecasts'[Forecast__c] ))
    RETURN
        SolarVerhouding_ * SensorForecast_
)

 

Hi John,

 

Thanks for your quick reply. I've tried this, but now I get a really big number as my total. So I don't think this is the solution.

 

 

I've updated my original post to force context transition, should be OK now I think

Thanks a lot. It works!

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.

Top Solution Authors