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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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