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
racs
Frequent Visitor

Help needed to Calculate repeat sales as number of times sold

Hi, 

I'm trying to calculate how many times a product is sold over the months in the order at least 1 time, 2+ times, 3+ 

In my Sales data table, I have column for "# of times Sold". I created a Matrix visualization with following parameters:

Rows:  "# of Times Sold"

Columns: "Month"

Values: Count of # of Times Sold

Below is the Output of this visualization.

 

Sample Sales Data Table:

Month# of Times Sold

Jan

1
Jan2
Jan2
Jan3
Jan3
Jan3
Jan4
Jan1
Jan2
Jan3
Jan3
Jan5
Jan1
Jan4
Jan4

 

Example Current Output (Matrix Visualization):

# of Repeat SalesJan
14
23
35
43
52
Total17

 

However, I'm a beginner and need help to create the following output.

Here, assuming everything is atleast sold once, so

Atleast 1 time = total count of # of Times Sold"

2+ times = Count of "# Times Sold" with column values >=2

3+ times = Count of "# Times Sold" with column values >=3

and so on

 

Example Desired Output:

# of Repeat SalesJan
At least 1 time17
2+ times13
3+ times10
4+ times5
5+ times2

 

Any help or guidance regarding this is greately appreciated. 

Thank you.

1 ACCEPTED SOLUTION
racs
Frequent Visitor

Hi @FreemanZ

Thanks for your reply.

I tried creating matrix visualization with this measure, doesn't seem to work for me.

 

I was somehow able to create the desired output by using following steps:

  1. I created separate measures each for
    • Sold atleast 1 time = Count('Sales'[# of Times Sold])
    • Sold 2+ times = Calculate(Count('Sales'[# of Times Sold]), 'Sales'[# of Times Sold]>=2)
    • and so on
  2. I created a matrix visualization with following parameters:
    • Columns: Month
    • Values:
      1. Sold at least 1 time
      2. Sold 2+ times
      3. Sold 3+ times
      4. Sold 4+ times
      5. Sold 5+ times
    • Under Format Paint Settings > Values > Options > Switch values to rows (On)

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @racs 

try to plot a matrix visual with the two columns and a measure like:

measure = 
COUNTROWS(
    FILTER(
        ALL(data),
        data[# of Times Sold] >= MAX(data[# of Times Sold])
    )
)

it worked like:

FreemanZ_0-1682696964500.png

 

p.s. your dataset seems lacking one row for 1 and 5 each.

racs
Frequent Visitor

Hi @FreemanZ

Thanks for your reply.

I tried creating matrix visualization with this measure, doesn't seem to work for me.

 

I was somehow able to create the desired output by using following steps:

  1. I created separate measures each for
    • Sold atleast 1 time = Count('Sales'[# of Times Sold])
    • Sold 2+ times = Calculate(Count('Sales'[# of Times Sold]), 'Sales'[# of Times Sold]>=2)
    • and so on
  2. I created a matrix visualization with following parameters:
    • Columns: Month
    • Values:
      1. Sold at least 1 time
      2. Sold 2+ times
      3. Sold 3+ times
      4. Sold 4+ times
      5. Sold 5+ times
    • Under Format Paint Settings > Values > Options > Switch values to rows (On)

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.