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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Nash2Bos
Helper I
Helper I

trying to take an excel table into powerBI

Hello all, I have a table that looks like this

 

CITYITEMPlan/ActualWeek 1Week 2Week 3Week 4
BostonProductPlan105810
 ProductActual10489
 ServicePlan10489
 ServiceActual9884
 TotalPlan2091619
  Actual19121613
  Plus/Minus-1+30-6

The issue I am having is the total isnt a total of the column it is product.plan + service.plan and product.actual+service.actual. Also the plus minus in excel it is easy to to a formula for cells but not sure how to do it in PowerBI. 

I also have more cities this is just one city example. 

 

Thank you so much in advance for everyones help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Nash2Bos ,

 

Organize the data so that all rows of Total are at the bottom of all cities, and then all rows of Total have all values of 0.

vdengllimsft_0-1738896130250.png

 

Select the CITY,ITEM,Plan/Actual columns and unpivot other columns. Then click the Close & Apply button to load the data into Power BI.

vdengllimsft_2-1738896483338.png

 

Use the following measure as the value.

Total = 
VAR _item = SELECTEDVALUE('Table'[ITEM])
VAR _plan = SELECTEDVALUE('Table'[Plan/Actual])
VAR _value = SUM('Table'[Value])
VAR _TotalActualValue = CALCULATE(SUM('Table'[Value]),'Table'[ITEM] IN {"Product","Service"} && 'Table'[Plan/Actual]="Actual"&&'Table'[CITY] <>BLANK())
VAR _TotalPlanValue = CALCULATE(SUM('Table'[Value]),'Table'[ITEM] IN {"Product","Service"} && 'Table'[Plan/Actual]="Plan"&&'Table'[CITY] <>BLANK())
RETURN
IF(_item IN {"Product","Service"},_value,
    SWITCH(_plan,
            "Actual", _TotalActualValue,
            "Plan", _TotalPlanValue,
            "Plus/Minus", _TotalActualValue - _TotalPlanValue
    )
)

 

Create a matrix using fields and the measure. 

vdengllimsft_3-1738897094052.png

 

For multiple cities.

The source data is as follows.

vdengllimsft_4-1738897163199.png

The final result is as follows. Hopefully it will meet your needs.

vdengllimsft_5-1738897257280.png


Please see the attached pbix for reference.

 

Best Regards,
Dengliang Li

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Nash2Bos ,

 

Organize the data so that all rows of Total are at the bottom of all cities, and then all rows of Total have all values of 0.

vdengllimsft_0-1738896130250.png

 

Select the CITY,ITEM,Plan/Actual columns and unpivot other columns. Then click the Close & Apply button to load the data into Power BI.

vdengllimsft_2-1738896483338.png

 

Use the following measure as the value.

Total = 
VAR _item = SELECTEDVALUE('Table'[ITEM])
VAR _plan = SELECTEDVALUE('Table'[Plan/Actual])
VAR _value = SUM('Table'[Value])
VAR _TotalActualValue = CALCULATE(SUM('Table'[Value]),'Table'[ITEM] IN {"Product","Service"} && 'Table'[Plan/Actual]="Actual"&&'Table'[CITY] <>BLANK())
VAR _TotalPlanValue = CALCULATE(SUM('Table'[Value]),'Table'[ITEM] IN {"Product","Service"} && 'Table'[Plan/Actual]="Plan"&&'Table'[CITY] <>BLANK())
RETURN
IF(_item IN {"Product","Service"},_value,
    SWITCH(_plan,
            "Actual", _TotalActualValue,
            "Plan", _TotalPlanValue,
            "Plus/Minus", _TotalActualValue - _TotalPlanValue
    )
)

 

Create a matrix using fields and the measure. 

vdengllimsft_3-1738897094052.png

 

For multiple cities.

The source data is as follows.

vdengllimsft_4-1738897163199.png

The final result is as follows. Hopefully it will meet your needs.

vdengllimsft_5-1738897257280.png


Please see the attached pbix for reference.

 

Best Regards,
Dengliang Li

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

Thank you! 
quick question what if I want to do a plus/minus by city in between and then a final plus/minus at the bottom?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.