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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
JBankston
Frequent Visitor

Group by Calculated Column, Tabular Editor

Greetings All, 

Needing some help here.  Using a SWITCH function I created my rows.  I am having difficultly creating the "Net" portion for the rows.   Anytime I try to add/subtract in the SWITCH it gives me errors.  I've spent a couple of days trying different examples I found online and have not been able to resolve my issue. 

Any help would be greatly appreciated. 

 

ie: "Freight in Expense" - "Freight in Income" = "Net Freight in Expense"


This is what I want it to look like:

JBankston_0-1745329624788.png


Here is my SWITCH:

 

VAR _FiE = 'TableA'[AcctNbr] = "1111"
VAR _FiI = 'TableA'[AcctNbr] IN { "5555", "6666"}
VAR _DI = 'TableA'[AcctNbr] IN { "8888", "7777" }
VAR _DE = 'TableA'[AcctNbr] IN { "2222", "3333"}

RETURN
SWITCH(
TRUE(),
_FiE, "Freight Income",
_FiI, "Freight Expense",
_FiE-_FiI, "Net Freight Expense”,
_DI, "Delivery Income",
_DE, "Delivery Expense",
_DE-_DI, "Net Delivery Expense"
)

Thank you. 

1 ACCEPTED SOLUTION
JBankston
Frequent Visitor

I resolved my issue.  I used a disconnected table and built a measure to complete my calculations. 

View solution in original post

3 REPLIES 3
JBankston
Frequent Visitor

I resolved my issue.  I used a disconnected table and built a measure to complete my calculations. 

ryan_mayu
Super User
Super User

could you pls provide some sample data? how many tables do you have?

 





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

Proud to be a Super User!




Bmejia
Super User
Super User

Hi,
just add another variable that does the subtraction.  you can't do a subtraction in your statement you can't say if A is subtracted by B then it is  A-B".
Thanks,
B
VAR _Subtract = _FiE-_FiI

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.