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
sb991986
Helper I
Helper I

Sumx total in each row & total

Hi,

In the following image, How can i get the total for a new column as 1300 (Sum of 800+500) but individual row as 800, 500 group by header id (see image below)?

sb991986_0-1624029389923.png

 

Thanks in advance!

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @sb991986 ,

 

 

for a measure and also for a calculated column the following formula should work:

 

New Column =
CALCULATE(
    SUM( myTable[Revenue] ),
    ALLEXCEPT( myTable, myTable[Header ID] )
)

 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

7 REPLIES 7
v-xulin-mstf
Community Support
Community Support

Hi @sb991986

 

Try meausre as:

Measure = 
var _sum=
SUMX(
    FILTER(
        ALL('Table'),
        'Table'[Header ID]=MAX('Table'[Header ID])
    ),
    'Table'[Revenue]
)
return 
IF(
    HASONEVALUE('Table'[Revenue]),
    _sum,
    SUM('Table'[Revenue])
    )

Here is the output:

vxulinmstf_0-1624260181559.png

The pbix is attached.

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

selimovd
Super User
Super User

Hey @sb991986 ,

 

 

for a measure and also for a calculated column the following formula should work:

 

New Column =
CALCULATE(
    SUM( myTable[Revenue] ),
    ALLEXCEPT( myTable, myTable[Header ID] )
)

 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi,

In the above example, I would need total as 1300 but individual row as 800, 500 by header id & detail id. Thank you

amitchandak
Super User
Super User

@sb991986 ,

 

calculate(sum(Table[revenue]), allselected(Table))

 

or

 

calculate(sum(Table[revenue]), all(Table))

Hi,

In the above example, I would need total as 1300 but individual row as 800, 500 by header id & detail id

@sb991986 , Try like

sumx(values(Table[Header ID]), calculate(sum(Table[revenue]), filter(allselected(Table), Table[Header ID] = max(Table[Header ID]))))

I tried your logic but it didn't work. Thank you fro your help

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.