Forum Discussion

tejapowerbi123's avatar
5 years ago
Solved

Month over Month Change without Date Table

Hi,

Can you any one suggest me the best way to calculate “Month over Month Changes” for below data set?

***I do not have Data Table in current data set

Thanks

 

Month

Product

Jan-2020

A

Feb-2020

A

Jan-2020

A

Feb-2020

A

Feb-2020

A


Month over Month Change Formula=

Var thismonth=count(‘test table’[product])
var lastmonth=
                         calculate(count (‘test table’[product]),
                                                                 filter(all((‘test table’[product]),
                                                                      (‘test table’[month]=max(‘test table’[product])-1))
Return
thismonth-lastmonth
                        

  • amitchandak's avatar
    amitchandak
    5 years ago

    tejapowerbi123 , once you have date like this in the table and change data type to date.

    Create a date table

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

     

    You can use formula like these 

    MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
    last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
    last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
    next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))
    this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
    last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
    previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

     

    diff = [MTD Sales]-[last MTD Sales]
    diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

     

    Refer my blog and video Month on Month with or Without Time Intelligence(TI)
    https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
    https://www.youtube.com/watch?v=6LUBbvcxtKA

     

    And why TI fails https://www.youtube.com/watch?v=OBf0rjpp5Hw

     

3 Replies

    • tejapowerbi123's avatar
      tejapowerbi123
      Helper V

      Hi amitchandak 

      Thank you so much for your suggestion,

      Correct me if i am wrong,As per your suggestions 

      1.Need Date Table in below format

      Month Number with Name & Year

      01-Jan-2020
      02-Feb-2020
      01-Jan-2019
      02-Feb-2019

      Once i have date table i need to connect it with main table.

      How about the formula ?

       

      Thanks

      • amitchandak's avatar
        amitchandak
        Super User

        tejapowerbi123 , once you have date like this in the table and change data type to date.

        Create a date table

        To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

         

        You can use formula like these 

        MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
        last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
        last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
        next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))
        this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
        last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
        previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

         

        diff = [MTD Sales]-[last MTD Sales]
        diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

         

        Refer my blog and video Month on Month with or Without Time Intelligence(TI)
        https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
        https://www.youtube.com/watch?v=6LUBbvcxtKA

         

        And why TI fails https://www.youtube.com/watch?v=OBf0rjpp5Hw