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
blboun08
New Member

Using a measure in the SUMMARIZE "Expression" field

Hi,

 

I'm trying to make a sum of a calculated column :

 

Trd_StdDev =

SUMX(

SUMMARIZE(

Database,

Database[CropYear],

"SumQuant",

(SUM(Database[Quantity]) - ([CropYear]*(Database[Trd_Slope])))

),

[SumQuant]

)

 

Idea here is to summarize the quantity by CropYear, grouping all other columns.

Then I want to create sum of all the rows but substracting a quantity which depends on : the CropYear and another measure called "Trd_Slope".

 

In my example, this measure is -286.56

 

When I replace Database[Trd_Slope] by its value -286.56, I get to the right calculation. But when I put back my measure "Database[Trd_Slope]", the text "Trd_Slope" becomes purple and the value of Trd_StdDev becomes "NaN"

 

Any idea on how I could use this measure in the "Expression" field of the SUMMARIZE function ?

 

Thanks in advance

1 REPLY 1
v-haibl-msft
Employee
Employee

@blboun08

 

Please try to define a variable for your Trd_Slope measure in the expression like below.

 

Trd_StdDev =
VAR TrdS = ‘Measure Formula’
RETURN
    SUMX (
        SUMMARIZE (
            Database,
            Database[CropYear],
            "SumQuant", (
                SUM ( Database[Quantity] )
                    - ( [CropYear] * TrdS )
            )
        ),
        [SumQuant]
)

 

Best Regards,

Herbert

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.