Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Percentage Difference using a Date variable

I have a dataset called Call_Trans.   This is a date variable called WeekEnd (this is a week end date of Sunday). I also have a numerical varibale called Transf.  What I'd like is to have a tabl...
  • devesh_gupta's avatar
    devesh_gupta
    2 years ago

    Anonymous It's not an option to click and select something, that line means to add a column named "% Difference". Okay leave it, we can create a matrix visual.

    Here are the steps to create a table:

    1. Open Power BI Desktop and click on “Get Data” to import your dataset.
    2. Once your data is loaded, click on “Report” in the left-hand pane.
    3. Click on the “Matrix” visual in the “Visualizations” pane.
    4. Drag the “WeekEnd” field to the Rows section of the visual.
    5. Drag the “Transf” field to the Values section of the visual.
    6. To add a column that shows the % difference from the week before, you can use Power BI’s formula feature. Here are the steps to add a column:
      1. Click on “New Measure” in the “Fields” pane.
      2. In the formula bar, enter the following formula: 

     

    Percent Difference = DIVIDE([Transf] - CALCULATE([Transf], PREVIOUSWEEK([WeekEnd])), CALCULATE([Transf], PREVIOUSWEEK([WeekEnd])))​

     

    • Click on “OK”.
    • Drag the “Percent Difference” field to the Values section of the visual.

    This will give you a table with WeekEnd in rows, Transfers in columns, and a new column that shows the % difference from the week before.

    I hope this helps!

     

    If you find this insightful, please provide a Kudo and accept this as a solution.