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

Calculate total sum by category and add extra value to each category.

Hi, 

this time i would like to ask you to support me in following case: 


inputa table 

koooala_0-1641579588748.png

Expected table -  works well

koooala_1-1641579635745.png

Measure to improve 

koooala_2-1641579802950.png

Result of measure 

koooala_3-1641579879174.png

 

koooala_5-1641579901627.png

How to update syntax in measure to have 
calculated total sum by category and have posibilities to add extra value to each category.

Thank you in advance for your reply. 

 



1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

My first thought was that you just need to move "+ 100" inside SUMX but that would give 407, not 307.

 

You need to iterate at the level you want to sum at (Category).

CategorySum =
SUMX (
    VALUES ( 'Table'[Category] ),
    CALCULATE ( SUM ( 'Table'[Value] ) + 100 )
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

My first thought was that you just need to move "+ 100" inside SUMX but that would give 407, not 307.

 

You need to iterate at the level you want to sum at (Category).

CategorySum =
SUMX (
    VALUES ( 'Table'[Category] ),
    CALCULATE ( SUM ( 'Table'[Value] ) + 100 )
)
smpa01
Super User
Super User

@Anonymous  try this

Measure =
SUMX (
    ADDCOLUMNS (
        VALUES ( 'Table'[Category] ),
        "sum", CALCULATE ( SUM ( 'Table'[Value] ) ) + 100
    ),
    [sum]
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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