Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Haydn_R
Helper I
Helper I

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 table where in the Rows will be WeekEnd and column will be Transfers, but I'd also like to show the % difference from the week before.

1 ACCEPTED SOLUTION

@Haydn_R 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.

View solution in original post

3 REPLIES 3
Haydn_R
Helper I
Helper I

Thank you for your reply, however this isn't an option to Right-click on the Transfers field in the Values section and select Add Column > % Difference. in my version of powerBI

@Haydn_R 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.

devesh_gupta
Super User
Super User

@Haydn_R 

To create a table in Power BI with rows representing the WeekEnd dates and columns representing the Transfers, along with the percentage difference from the previous week, you can follow these steps:

  1. Create a table visual in Power BI.
  2. Place the WeekEnd field in the Rows section of the visual.
  3. Place the Transfers field in the Values section of the visual.
  4. Right-click on the Transfers field in the Values section and select Add Column > % Difference.
  5. In the formula bar, enter the following DAX formula to calculate the percentage difference from the previous week:
% Difference = DIVIDE([Transfers], CALCULATE([Transfers], PREVIOUSWEEK()))
  1. Format the % Difference column as a percentage.

By following these steps, you can create a table visual in Power BI that displays WeekEnd dates in rows, Transfers in columns, and the percentage difference from the previous week.

 

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.