Forum Discussion

cjcj's avatar
cjcj
Icon for Helper I rankHelper I
4 years ago
Solved

Previous month sales

Hi I have read a few posts on this issue, but I could not get anything to work properly.   I have the following table and want to create a measure to find the difference from the current Selected m...
  • MahyarTF's avatar
    4 years ago

    Hi

    Use the below code instead of the "MAY" :

    Format( month(EOMONTH( SELECTEDVALUE( 'DIM_Date'[Date]), -1 ) ), "MMM")
    Appreciate your Kudos
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below picture and the attached pbix file.

    I tried to create a sample pbix file like below, and I suggest having a calendar table like below.

    I hope the below sample can provide some ideas on how to create a solution for your dataset.

     

     

    Sales measure: = 
    SUM( Sales[Sales] )

     

    Sales Previous month: = 
        CALCULATE( [Sales measure:], 
            DATEADD( 'Calendar'[Date], -1, MONTH ) 
        )

     

    Sales diff: = 
    IF( not ISBLANK( [Sales measure:] ), [Sales measure:] - [Sales Previous month:] )