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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to get the amount of returned products

Hi,

 

I'm trying to create a visualization where I'm able to show how many orders were returned for each year. I made the relationship between my Orders and Returns table, and I also created a Calendar that's connected to my Order date column.

 

Basically, what I want to achieve is if I have this in my Orders table:

 

tvadoc_0-1663688710766.png

 

And I have this in my Returns table:

tvadoc_1-1663688773887.png

 

I want to get the following result:

tvadoc_2-1663688899236.png

 

How should I do this?
I'm sending my sample file if it is any help: https://fastupload.io/en/pCmUoJN7HxWSvzK/file

 

Thank you for the help.

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description,  you want to show how many orders were returned for each year.Right?

Here are steps you can refer to:

(1)I import your sample file in the Power BI Desktop and i create a 'Date' table .Then i create the relationship between tables like you said.

 

Date = CALENDAR( FIRSTDATE('Orders'[Order Date]),LASTDATE( 'Orders'[Order Date]))

 

vyueyunzhmsft_0-1663730041280.png

(2)We can create a measure : [Amount of returns]

 

Amount of returns = COUNTROWS( FILTER('Orders' , 'Orders'[Order ID] in VALUES('Returns'[Order ID])))

 

(3)We can put the 'Date'[Year] and [Amount of returns] in the Table visuals. Then we can meet your need , the result is as follows :

vyueyunzhmsft_1-1663730137554.png

If this method does not meet your needs, you can provide us with the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

4 REPLIES 4
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description,  you want to show how many orders were returned for each year.Right?

Here are steps you can refer to:

(1)I import your sample file in the Power BI Desktop and i create a 'Date' table .Then i create the relationship between tables like you said.

 

Date = CALENDAR( FIRSTDATE('Orders'[Order Date]),LASTDATE( 'Orders'[Order Date]))

 

vyueyunzhmsft_0-1663730041280.png

(2)We can create a measure : [Amount of returns]

 

Amount of returns = COUNTROWS( FILTER('Orders' , 'Orders'[Order ID] in VALUES('Returns'[Order ID])))

 

(3)We can put the 'Date'[Year] and [Amount of returns] in the Table visuals. Then we can meet your need , the result is as follows :

vyueyunzhmsft_1-1663730137554.png

If this method does not meet your needs, you can provide us with the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

tamerj1
Super User
Super User

Hi @Anonymous 

please try

Amount of Return =
COUNTROWS ( FILTER ( Orders, Orders[Order ID] IN VALUES ( Return[Order ID] ) ) )

tackytechtom
Super User
Super User

Hi @Anonymous ,

 

In the table, I chose the year column from Order Date. Note "År" is year in Swedish...

tomfox_2-1663690923984.png

 

 

This is what I did:

tomfox_0-1663690841741.png

 

Then create a measure:

CountReturnedOrders = CALCULATE ( DISTINCTCOUNT ( 'order'[Order ID]),  returns[Returned] = "Yes" )
 
Then use it in a graph like this:
tomfox_1-1663690906374.png

 

 

Hope this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Greg_Deckler
Community Champion
Community Champion

@Anonymous Maybe make your Order to Return relationship Both direction?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.