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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
admin11
Memorable Member
Memorable Member

P&L Table how to compute GP% for LYTD ? ( YTD column no issue )

Hi All

 

I have below expression  :-

 

PnL CY = SWITCH(SELECTEDVALUE('_PnL_Var'[PnL_Var]),
"2_COGS",[AMOUNT_COGS],
"1_REV", [AMOUNT_REV_N],
"3_OTH", [AMOUNT_OTH_IN],
"4_EXP", [AMOUNT_EXP],
"5_NET_P",[AMOUNT_NP_],
"6_GPM",[AMOUNT_GP],
"7_NPM",[AMOUNT_NP]
)
 The above expression create below report table , which the 6_GPM wrong , it should be 0.38 , but it return 0.45
 
admin11_0-1648507569405.png

My 6_GPM expression as below :-

 
AMOUNT_GP = DIVIDE([AMOUNT_REV_N]+[AMOUNT_COGS],[AMOUNT_REV_N])
 
Can some one share with me how to make the GP% display correct value ?
 
Hint :- For YTD column , it can display correct GP% , But LYTD it display wrongly GP% ,
Paul Yeo
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@admin11 , for LYTD you can try measure like

 

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@admin11 , for LYTD you can try measure like

 

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak 

Thank you for answer my post.

 
Also thank you for propose expression for LYTD REV .
 
I have check my LYTD REV expression as below :-
_LYTD_REV =
var _max = date(year(today())-1,month(today()),day(today()))
return
TOTALYTD
(
('GL'[AMOUNT_REV]),
dateadd('DATE'[Date],
-1,year),
'DATE'[Date]<=_max
)
 
it can return correct LYTD amount on Revenue and COGS. But i get the GP% wrong value. for YTD no issue. So must be the below cause the issue right ?
 
AMOUNT_GP = DIVIDE([AMOUNT_REV_N]+[AMOUNT_COGS],[AMOUNT_REV_N])
 
Paul

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.