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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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-rongtiep-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-rongtiep-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-rongtiep-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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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