Forum Discussion
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.
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:
- Open Power BI Desktop and click on “Get Data” to import your dataset.
- Once your data is loaded, click on “Report” in the left-hand pane.
- Click on the “Matrix” visual in the “Visualizations” pane.
- Drag the “WeekEnd” field to the Rows section of the visual.
- Drag the “Transf” field to the Values section of the visual.
- 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:
- Click on “New Measure” in the “Fields” pane.
- 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.
3 Replies
- AnonymousNot applicable
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
- devesh_guptaImpactful Individual
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:
- Open Power BI Desktop and click on “Get Data” to import your dataset.
- Once your data is loaded, click on “Report” in the left-hand pane.
- Click on the “Matrix” visual in the “Visualizations” pane.
- Drag the “WeekEnd” field to the Rows section of the visual.
- Drag the “Transf” field to the Values section of the visual.
- 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:
- Click on “New Measure” in the “Fields” pane.
- 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_guptaImpactful Individual
Anonymous
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:
- Create a table visual in Power BI.
- Place the WeekEnd field in the Rows section of the visual.
- Place the Transfers field in the Values section of the visual.
- Right-click on the Transfers field in the Values section and select Add Column > % Difference.
- In the formula bar, enter the following DAX formula to calculate the percentage difference from the previous week:
% Difference = DIVIDE([Transfers], CALCULATE([Transfers], PREVIOUSWEEK()))
- 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.