Forum Discussion

salmanalisalman's avatar
salmanalisalman
New Member
2 years ago

creating a sales difference

Dear 
I really need your intelegence! I need your help! I will tell you what i want at the end, plz bear with me, brothers and sisters.
I have a table called " source"
colmun A is "Date" containing all months of the year
column B is "branches" I have 50 branches
column C is "Sales" for all months in each branch
i want to know the sales difference between months
for example, sales in month 1 is 50000, and month 2 is 40000 i want to decreased amount that is 10000 with minus
i really searched but no way, i come here with all my confide on you 


3 Replies

  • salmanalisalman , You can create a dax measure for this

     

    Sales Difference =
    VAR CurrentDate = 'source'[Date]
    VAR CurrentBranch = 'source'[Branches]
    VAR PreviousSales =
    CALCULATE(
    SUM('source'[Sales]),
    FILTER(
    'source',
    'source'[Branches] = CurrentBranch &&
    'source'[Date] = DATEADD(CurrentDate, -1, MONTH)
    )
    )
    RETURN
    IF(
    ISBLANK(PreviousSales),
    BLANK(),
    'source'[Sales] - PreviousSales
    )

  • Thanks dear for your prompt reply, but look when i right the apostrophe it shows me something else