Forum Discussion
likmalik
5 years agoHelper I
Mix 2 really simple formulas
Hello I'm using a formula to get the market share of car models and it works without problem.
Market share =
DIVIDE ( SUM ( Sheet1[True Fleets] ),
CALCULATE ( SUM ( 'Sheet1'[True Fleets]), ALL( 'Sheet1'[Model]) ))*100
But I want to add a formula inside to have specific date :
DATESBETWEEN(Sheet1[Date], DATE(2020,01,01),DATE(2020,12,31))
How can I mix the two please.
Thankyou
Give this a try.
Market share = CALCULATE ( DIVIDE ( SUM ( Sheet1[True Fleets] ), CALCULATE ( SUM ( 'Sheet1'[True Fleets] ), ALL ( 'Sheet1'[Model] ) ) ) * 100, DATESBETWEEN ( Sheet1[Date], DATE ( 2020, 01, 01 ), DATE ( 2020, 12, 31 ) ) )
3 Replies
- amitchandakSuper User
likmalik , Try like
CALCULATE ( DIVIDE ( SUM ( Sheet1[True Fleets] ),
CALCULATE ( SUM ( 'Sheet1'[True Fleets]), ALL( 'Sheet1'[Model]) ))*100, DATESBETWEEN(Sheet1[Date], DATE(2020,01,01),DATE(2020,12,31)) ) - jdbuchanan71Super User
Give this a try.
Market share = CALCULATE ( DIVIDE ( SUM ( Sheet1[True Fleets] ), CALCULATE ( SUM ( 'Sheet1'[True Fleets] ), ALL ( 'Sheet1'[Model] ) ) ) * 100, DATESBETWEEN ( Sheet1[Date], DATE ( 2020, 01, 01 ), DATE ( 2020, 12, 31 ) ) ) - negi007Community Champion
Add this in numertor and denominator condition inside calculate function
DATEADD('Vol-Data'[Date].[Date], 0, YEAR)0= current year-1 = previous year