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

Calculate gross profit from the amount column and then match with same period last year

Hello,

I am relatively new to DAX woudl like to know if this is possible what i am trying to do .

 

 i have three table 

1. transaction table for last 24 months named as facttable

has  four columns 1. account 2. Amount 3. Actual 4.Month

 

2. Second table is dimaccountcode table  having 1. account and 2. Nature column

 

3. Table is the date table 

 

i have created a relation between facttable [account] and  dimaccountcode[account]

and between calendar table date and  facttable [month] column.

 

The nature column in the dimaccountcode table has 

sales , cogs , and discount fields which i have pulled it to fact table using related function

 

Now i  have created the following pivot table 

Year2023 
BRANDDESCAll 
   
Row LabelsPrv. Year  ValueCrnt Year  Value
January  
Sales-           22,721,371-         21,655,006
Discount               1,303,606             1,046,479
Advt. & Promo               2,801,615             2,638,647
Cost of Goods Sold            15,872,109           13,727,417
Total-             2,744,040-            4,242,463
February  
Sales-           23,512,275-         23,789,792
Discount               1,239,852             1,291,257
Advt. & Promo               2,477,935             3,715,936
Cost of Goods Sold            16,717,937           15,362,707
Total-             3,076,551-            3,419,892

 

i need to calculate and add Gross profit as a measure but i am not able to.  Gross profit is total of all the nature displayed in the above table . currently in the pivot field values column  Prv. Year  Value and Crnt Year  Value has been selected this two measures have been calculated as follows.

Crnt Year Value:=sum(facttable[Amount])

Prv Year Value:=CALCULATE([Sum of Amount],SAMEPERIODLASTYEAR(dCalendar[Date])).

 

Any suggestion in assisting me to  arriving at gross profit would be really helpful.

 

Thank you 

 

 

1 REPLY 1
some_bih
Super User
Super User

Hi @JayantS check link by @amitchandak  I hope this help

https://community.fabric.microsoft.com/t5/Data-Stories-Gallery/Power-BI-Formatted-Profit-and-Loss-St... 





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

Proud to be a Super User!






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.

Top Solution Authors