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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Luzadriana255
Helper II
Helper II

Calculating the total amount of sales without counting repeated order values

Hello,
I am trying to build a matrix of the total sales of different products as a function of time. In my excel list there are orders that appear more than once and I want to count the price of those orders only once. For example for toys in June I want to add only once 200 because it comes from the same order "Order 1".

 

My data look like the one in the following table:

 

Product codeOrder     Date     Sales
Toys     1     06.06.2022     200
Toys     1                  06.06.2022      200
Toys     2      12.06.2022      135
Clothes     3      09.06.2022      160
Clothes     4      23.06.2022      135
Clothes     4      23.06.2022      135
Toys     5      03.07.2022      50
Toys     5      03.07.2022      50
Toys     7      22.07.2022      20
Toys     8      03.07.2022      60
Clothes     6      09.07.2022      200
Clothes     9      12.07.2022      200
Clothes    10      12.07.2022      25

 

I want to develop a Dashboard  matrix like the following:

 

Product/timeJuneJuly
Toys335130
Clothes295425


However I am not sure what formula to use for this. Thank you for your help.

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1673451616455.png

 

Jihwan_Kim_2-1673451736540.png

 

 

Expected result measure: =
SUMX (
    SUMMARIZE (
        Data,
        'Product'[Product code],
        'Calendar'[Date],
        Data[Order],
        Data[Sales]
    ),
    Data[Sales]
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

jewel_at
Helper II
Helper II

Hi @Luzadriana255 

 

You can also consider using the Remove Duplicates in Power Query, if you're not using that info in other visuals. 

 

  • Select the Order, Date and Sales columns 
  • Go to Home > Remove Row > Remove Duplicates

 

Jewel

 

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

hi @Luzadriana255 

 

you may also try to plot a table visual with two measures like this:

JUN = 
VAR _table = DISTINCT(TableName)
RETURN
SUMX(
    FILTER(_table, MONTH(TableName[Date]) =6),
    TableName[Sales] 
)

JUL = 
VAR _table = DISTINCT(TableName)
RETURN
SUMX(
    FILTER(_table, MONTH(TableName[Date]) =7),
    TableName[Sales] 
)

 

it worked like this:

FreemanZ_0-1673454331511.png

Sounds good, however I have many different months and years, so it may take so much time to include every month. Thank you!

jewel_at
Helper II
Helper II

Hi @Luzadriana255 

 

You can also consider using the Remove Duplicates in Power Query, if you're not using that info in other visuals. 

 

  • Select the Order, Date and Sales columns 
  • Go to Home > Remove Row > Remove Duplicates

 

Jewel

 

Thank you so much!

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1673451616455.png

 

Jihwan_Kim_2-1673451736540.png

 

 

Expected result measure: =
SUMX (
    SUMMARIZE (
        Data,
        'Product'[Product code],
        'Calendar'[Date],
        Data[Order],
        Data[Sales]
    ),
    Data[Sales]
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thank you so much!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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