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
aartiladdha
Employee
Employee

calculating true sum of a measure

I am trying to create a measure that shows actual sum total of all rows instead of just the overall.  Below is my data. Please note that all the fields are "measures" and not columns.  I want the Net Avail Supply IBP Non-Negative (Dyn) Pal measure to show 3.16 instead of 0 as shown below. This measure has a condition that

 if Total SUpply IBP (Actual Inv Only) (Pal) - Future IBP Demand Pal <0, 0 Total SUpply IBP (Actual Inv Only) (Pal) - Future IBP Demand Pal 

Tried using Sumx but it's not working for me. 

 

Capture.PNG

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

Hi @aartiladdha ,

 

We can use the GROUPBY function in SUMX to fix it, please change the [Measure 3] to your measure,

 

Measure 4 =
SUMX (
    GROUPBY ( 'Table', 'Table'[date], 'Table'[SKU], 'Table'[Plant Code] ),
    [Measure 3]
)

 

If it does not work, try to use a CALCULATE function like following,

 

Measure 4 =
SUMX (
    GROUPBY ( 'Table', 'Table'[date], 'Table'[SKU], 'Table'[Plant Code] ),
    CALCULATE ( [Measure 3] )
)

 

Please put the fields, which set Do not summarize in table visual, into the GROUPBY function and sort them as they are in table visual.

 

The result like this,

 

calculating 1.jpg

 

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

3 REPLIES 3
v-zhenbw-msft
Community Support
Community Support

Hi @aartiladdha ,

 

We can use the GROUPBY function in SUMX to fix it, please change the [Measure 3] to your measure,

 

Measure 4 =
SUMX (
    GROUPBY ( 'Table', 'Table'[date], 'Table'[SKU], 'Table'[Plant Code] ),
    [Measure 3]
)

 

If it does not work, try to use a CALCULATE function like following,

 

Measure 4 =
SUMX (
    GROUPBY ( 'Table', 'Table'[date], 'Table'[SKU], 'Table'[Plant Code] ),
    CALCULATE ( [Measure 3] )
)

 

Please put the fields, which set Do not summarize in table visual, into the GROUPBY function and sort them as they are in table visual.

 

The result like this,

 

calculating 1.jpg

 

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

amitchandak
Super User
Super User

In sumx uses Values

 

Sumx(Values(Table[SKU]), <Your formula>)

or

Sumx(summarize(Table[SKU],"_1", <Your formula>),[_1])

 

Put your measure or calculation in <Your formula>

 

This doesn't work. Also, MY tabel grain is SKU, Plant Code, DATE. How do I specify that?

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.