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
iamsunil99
New Member

Row level calculation for making P&L account from Trial Balance

Hi,

 

I am trying to build a P&L account from the monthly TrialBalance of a company and I am stuck with an issue in achieving row level calculation.

Following is my base sample data for 2 months in BI(I have separate trials for the period and I have combined them in BI )

 

     
     
GL CodeDescriptionGL TypeAmountPeriod
aGross sales GLGross Sales100April
dDiscount GLDiscount20April
bRaw Material GLRM50April
cProcessing Cost GLOverhead10April
aGross sales GLGross Sales110May
dDiscount GLDiscount30May
bRaw Material GLRM60May
cProcessing Cost GLOverhead20May

 

I am trying to achieve the following output, but I am unable to do the required calculations(calculated New Fields) in row level.

 

 Period     
 AprilMay     
Gross Sales100110     
Discounts2030     
Net Sales8080calculated new field(Gross -Discount) 
RM5060     
Overhead1020     
Total Expenses6080calculated new field(RM + Overhead) 
Net Profit200calculated new Field(Net Sales - Total Expenses)
        

 

Kindly help me with the solution. Thanks in advance!!

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @iamsunil99 ,

You can follow the below steps to achieve it:

1. Create a calculated table with the below formula:

Table 2 = UNION(VALUES('Table'[GL Type]),ROW("GL Type","Net Sales"),ROW("GL Type","Total Expenses"),ROW("GL Type","xNet Profit"))

2. Create a measure to get the value of Net Sales, Total Expenses and Net Profit

Measure = 
var _nets= CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Gross Sales")- CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Discount") 
var _texp=CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="RM")+CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Overhead")
return switch(SELECTEDVALUE('Table 2'[GL Type]),"Net Sales",_nets,"Total Expenses",_texp,"xNet Profit",_nets-_texp,CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[GL Type]=MAX('Table 2'[GL Type]))))

3. Create a matrix visual( Rows: GL Type(from the new created table) Columns: Period  Values: Measure)

Row level calculation.JPG

Best Regards

Rena

Community Support Team _ Rena
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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @iamsunil99 ,

You can follow the below steps to achieve it:

1. Create a calculated table with the below formula:

Table 2 = UNION(VALUES('Table'[GL Type]),ROW("GL Type","Net Sales"),ROW("GL Type","Total Expenses"),ROW("GL Type","xNet Profit"))

2. Create a measure to get the value of Net Sales, Total Expenses and Net Profit

Measure = 
var _nets= CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Gross Sales")- CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Discount") 
var _texp=CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="RM")+CALCULATE(sum('Table'[Amount]),'Table'[GL Type]="Overhead")
return switch(SELECTEDVALUE('Table 2'[GL Type]),"Net Sales",_nets,"Total Expenses",_texp,"xNet Profit",_nets-_texp,CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[GL Type]=MAX('Table 2'[GL Type]))))

3. Create a matrix visual( Rows: GL Type(from the new created table) Columns: Period  Values: Measure)

Row level calculation.JPG

Best Regards

Rena

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

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.