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
dennis1994
Frequent Visitor

Subtotal in a Row

Hello,

I would like to do something like this:

Day      Label       Hours

01.01       R              2

01.01       I               2

01.01     Total           4

 

I got hours per Day that are split per Label. What I need is the total amount of hours per Day in an extra row. Is that possible?

 

Regards

Dennis

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @dennis1994,

 

Based on my test, you should be able to follow steps below to get the expected result.

 

1. Add new table with a single column like below to your model(make sure there is no any relationships between this table and the other tables).

 

t1.PNG

 

2. Use the formula below to create a new measure.

Measure = 
VAR lable =
    MAX ( Table2[Label] )
RETURN
    IF (
        lable = "Total",
        SUM ( Table1[Hours] ),
        CALCULATE ( SUM ( Table1[Hours] ), Table1[Label] = lable )
    )

m1.PNG

 

3. Show 'Day' column, 'Lable' column from the new added table, and the measure on Table visual.

 

r1.PNG

 

Here is the sample pbix file for your reference. Smiley Happy

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @dennis1994,

 

Based on my test, you should be able to follow steps below to get the expected result.

 

1. Add new table with a single column like below to your model(make sure there is no any relationships between this table and the other tables).

 

t1.PNG

 

2. Use the formula below to create a new measure.

Measure = 
VAR lable =
    MAX ( Table2[Label] )
RETURN
    IF (
        lable = "Total",
        SUM ( Table1[Hours] ),
        CALCULATE ( SUM ( Table1[Hours] ), Table1[Label] = lable )
    )

m1.PNG

 

3. Show 'Day' column, 'Lable' column from the new added table, and the measure on Table visual.

 

r1.PNG

 

Here is the sample pbix file for your reference. Smiley Happy

 

Regards

dennis1994
Frequent Visitor

Hello,

I would like to do something like this:

Day      Label       Hours

01.01       R              2

01.01       I               2

01.01     Total           4

 

I got hours per Day that are split per Label. What I need is the total amount of hours per Day in an extra row. Is that possible?

 

Regards

Dennis

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.