cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
clarer
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
v-polly-msft
Community Support
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.

11.PNG

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_

22.PNG

If I have misunderstood your meaning, please provide your pbix without privacy information and desired output.

 

 

 

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.

View solution in original post

3 REPLIES 3
v-polly-msft
Community Support
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.

v-polly-msft
Community Support
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.

11.PNG

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_

22.PNG

If I have misunderstood your meaning, please provide your pbix without privacy information and desired output.

 

 

 

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.

lbendlin
Super User
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.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors