Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JayV
Helper I
Helper I

Get total of multiple sub-totals in a visual

Hi! I need to create groups of services in a visual and show a total sum of these grouped values on Jan 2020
 
My data:

ServiceValueDate
112Jan 2020
230Jan 2020
321Jan 2020
332Jan 2020
112Feb 2020


The groups of services i need to create:
A: 1
B: 2
C: 3
First Grouped Total: 1, 2
Second Grouped total: 1, 2, 3

What i tried:
First i created a table for the groups called "Dimension"

JayV_0-1721246150106.png


Then i created a bridge table with distinct services for the relationship with the imported data

JayV_1-1721246163332.png


When i try creating the visual, the grand total won't match correctly, it must be "42+95" (groupedtotal_1 + groupedtotal_2)

JayV_0-1721252304031.png

 

 

What can i do? do i need to rethink everything? thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JayV 

 

Thanks for the reply from @danextian .

 

@JayV , please try the following measures:

total1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Service] = 1 || 'Table'[Service] = 2))

 

total2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Service] = 1 || 'Table'[Service] = 2 || 'Table'[Service] = 3))

 

Measure = 
VAR _total1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', SELECTEDVALUE('Table (2)'[Group]) = "groupedtotal_1")) + 0
VAR _total2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', SELECTEDVALUE('Table (2)'[Group]) = "groupedtotal_2")) + 0
RETURN
IF(ISFILTERED('Table (2)'[Group]), SUM([Value]), ([total1] + [total2]))

 

Output:

vxuxinyimsft_0-1721802518966.png

 

Best Regards,
Yulia Xu

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @JayV 

 

Thanks for the reply from @danextian .

 

@JayV , please try the following measures:

total1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Service] = 1 || 'Table'[Service] = 2))

 

total2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Service] = 1 || 'Table'[Service] = 2 || 'Table'[Service] = 3))

 

Measure = 
VAR _total1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', SELECTEDVALUE('Table (2)'[Group]) = "groupedtotal_1")) + 0
VAR _total2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', SELECTEDVALUE('Table (2)'[Group]) = "groupedtotal_2")) + 0
RETURN
IF(ISFILTERED('Table (2)'[Group]), SUM([Value]), ([total1] + [total2]))

 

Output:

vxuxinyimsft_0-1721802518966.png

 

Best Regards,
Yulia Xu

 

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

danextian
Super User
Super User

Hi @JayV 

 

Based on the information you provided, try this:

IF (
    NOT ( HASONEVALUE ( 'table'[Group] ) ),
    [groupedtotal_1] + [groupedtotal_2],
    [the other measure]
)

If this address your use case, please refer to this link on how you get your questions answered quickly - https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/td-p/144... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi! Grouped totals are not measures, they are values in the column "Group", and placing them in a measure will return an invalid name (Cannot find name "[groupedtotal_1]"), how will you do this?

Hi @JayV ,

 

As mentioned, https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/td-p/14...





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors