Forum Discussion

likmalik's avatar
likmalik
Helper I
5 years ago
Solved

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
 
 
  • likmalik 

    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

  • 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)) )

  • likmalik 

    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 ) )
    )
    
  • negi007's avatar
    negi007
    Community Champion

    likmalik 

     

    Add this in numertor and denominator condition inside calculate function 

     

    DATEADD('Vol-Data'[Date].[Date], 0, YEAR)
     
    0= current year
    -1 = previous year