cancel
Showing results for
Did you mean:
New Member

## Row by Row Percentage Calculation in a Table Visualisation

We are looking to add a percentage calculation column to work out row by row (given any filter applied) the appropriate calculation based on 2 other columns in a created table visualisation on a report.

However, the columns which are being pulled into the report table are not directly related in the model, they are related by a third table.

Essentially, data table 1 has order information on items, data table 2 has return information on items, the third data table relating them is item to prevent a many to many relationship.

We want to be able to calculate, in a given timeframe (date is a column on the order data table and the return data table), what has been the percentage of returns.

The end user needs to be able to filter on extra information such as return reason (return data table) and picker (order data table) depending on whatever date range they choose on the slider.

Can anyone help on how we can achieve this?

1 ACCEPTED SOLUTION
Community Support

Hi @clarer ,

I have create simple sample. Please refer to it to see if it helps you.

The relationship between these three tables is shown in the following picture.

Then Create a measure.

``````Measure =
VAR return_number =
CALCULATE (
SUM ( remove[Returns] ),
FILTER ( ALL ( remove ), remove[date] = SELECTEDVALUE ( 'order'[date] ) )
)
VAR percent_ =
DIVIDE ( return_number, SELECTEDVALUE ( 'order'[sales] ) )
RETURN
percent_
``````

Best Regards

Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Community Support

Hi @clarer ,

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

Best Regards

Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

Hi @clarer ,

I have create simple sample. Please refer to it to see if it helps you.

The relationship between these three tables is shown in the following picture.

Then Create a measure.

``````Measure =
VAR return_number =
CALCULATE (
SUM ( remove[Returns] ),
FILTER ( ALL ( remove ), remove[date] = SELECTEDVALUE ( 'order'[date] ) )
)
VAR percent_ =
DIVIDE ( return_number, SELECTEDVALUE ( 'order'[sales] ) )
RETURN
percent_
``````

Best Regards

Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

Announcements