Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Month on month comparison

Hi,

 

Raw data:

Date                Sales     Customer name

25-07-2020       500      Pavan

26-07-2020       800     suresh

27-07-2020       1000    sai

28-07-2020        500    naresh

01-06-2020        200    somu

25-06-2020        600    venkat

26-06-2020        800     sasi

 

 

i want output below in power bi 

 

Filter       flter

july        june

Customer name     july date sales   june datesales

Pavan                     500

suresh                    800 

sai                          1000

naresh                   500

somu                                              200

venkat                                            600

sai                                                   800

 

i dont have permission to send the raw data please consider raw above one.

 

Regards,

 

5 Replies

  • Hi, 

     

    Try using the Matrix visualization with the following: 

    - Rows: Customer name

    - Columns: Date (month)

    - Value: Sales

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      How to select filter month on month comparasion dynamically.

       

       

      Regards,

       

  • Anonymous , Try like. You need two date table, both have month year in that. Keep slicer from each one .

     

    measure1 =
    var _min = minX(allselected(Date,Date[Date]))
    var _max = manX(allselected(Date,Date[Date]))
    return
    calculate(sum(Table[Sales]), filter(Table,Table[Date]>=_min && Table[Date]<=_max))

     

    Use the crossfilter is Date is joined and active.

    measure2 =
    var _min = minX(allselected(Date1,Date1[Date]))
    var _max = manX(allselected(Date1,Date1[Date]))
    return
    calculate(sum(Table[Sales]), filter(Table,Table[Date]>=_min && Table[Date]<=_max))
    //calculate(sum(Table[Sales]), filter(Table,Table[Date]>=_min && Table[Date]<=_max), crossfilter(Table[Date],Date[Date],none))

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Here is a copy using your data 

     

    PBIX 

  • v-kelly-msft's avatar
    v-kelly-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    First create a column as below:

     

    Month = FORMAT('Table'[Date],"mmmm")&" "& "dates sales"

     

    Then put the Month in the column field of a matrix and you will see:

     

     

     

     

     

    For the related .pbix file,pls see attached.

     

     
    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!