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
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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


Thank you so much!

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.

Top Solution Authors