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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
PMY1965
Advocate I
Advocate I

Calculate cost price for the whole year based on "Calendar[Year]", not by other date slicers

Hi there,

I have this measure to calculate my Cost Price for the whole year, based on the slicer  "Calendar[Year]". I do have many other date slicers.  I still only get the value for the month selected "Calendar[Month]", not the whole year. Please help.

 
Note:  I edited my formular , sorry for my previous one.
 
CostPriceForThisYear = CALCULATE( SUM('GL_LedgerTrans'[Credit]), FILTER( ALLSELECTED('GL_LedgerTrans'), 'GL_LedgerTrans'[OffsetAcctID-3] = "632" && 'GL_LedgerTrans'[AccountID-4] = "1541" && YEAR('GL_LedgerTrans'[TransDate]) IN values('Calendar'[Year]) ), REMOVEFILTERS('Calendar'), KEEPFILTERS(VALUES('Calendar'[Year])) )
1 ACCEPTED SOLUTION
sjoerdvn
Super User
Super User

Hard to say without more info on your report and especiallly the sematic model relationship, but if there is an active relationship between that fact table and the Calendar table, try something like:

CostPriceForThisYear = CALCULATE( SUM('GL_LedgerTrans'[Credit])
	, 'GL_LedgerTrans'[OffsetAcctID-3] = "632" 
	, 'GL_LedgerTrans'[AccountID-4] = "1541"
	, ALL('Calendar')
	, VALUES('Calendar'[Year]))

View solution in original post

2 REPLIES 2
PMY1965
Advocate I
Advocate I

Wow, it works.  You are so amazing. Thank you very much. My day is brighter now.

sjoerdvn
Super User
Super User

Hard to say without more info on your report and especiallly the sematic model relationship, but if there is an active relationship between that fact table and the Calendar table, try something like:

CostPriceForThisYear = CALCULATE( SUM('GL_LedgerTrans'[Credit])
	, 'GL_LedgerTrans'[OffsetAcctID-3] = "632" 
	, 'GL_LedgerTrans'[AccountID-4] = "1541"
	, ALL('Calendar')
	, VALUES('Calendar'[Year]))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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