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

Measures for all SKU and SUM


I have a sales table where there is customer name, sales amount and SKU. What measure should I prescribe so that when choosing SKU and the amount, I can see only those customers who have sold for the required amount and have sold all the selected SKU? I tried to prescribe the measure myself.

Stores Selling All SKUs = COUNTROWS(FILTER(DISTINCT(Table[Store]), CALCULATE(DISTINCTCOUNT(Table[SKU])) = FILTER(Table2[SKU[))

1 ACCEPTED SOLUTION

Hi @laba031095 ,

 

Very clear example shows. 

Here's my soltuion.

1.Create a measure

Measure = var _count1=CALCULATE(DISTINCTCOUNT('Table'[Product]),ALLSELECTED('Table'))
var _count2=CALCULATE(COUNT('Table'[Shop]),FILTER(ALLSELECTED('Table'),[Shop]=MAX('Table'[Shop])))
return IF(ISFILTERED('Table'[Product]),IF(_count1=_count2,1),1)

 

2.Put the measure into Filters, and set show items when the value is 1.

vstephenmsft_0-1638343984317.png

 

 

3.Results is as follows.

vstephenmsft_1-1638344009819.png

vstephenmsft_2-1638344026720.png

 

 

Best Regards,

Stephen Tao

 

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

7 REPLIES 7
speedramps
Super User
Super User

"Sold all the SKUs" does not makes sense.  

Please make an proper effort to describe your problems with lots of examples if you want helping quickly.
We are not paid, we are volunter helpers. Thank you.

Good. Sorry, I just don't speak English well.

I have a table Sales

Example

Shop1 Product 1
Shop1 Product 2
Shop1 Product 3
Shop 2 Product 1
Shop 3 Product 1
Shop 3 Product 2
Shop 3 Product 3
Shop Product 4
I want to do measure
If i Select Product 1 Product 2 and Product 3

I see in table

Shop 1
Shop 3

If i select Product 1, i see

Shop 1
Shop 2
Shop 3

Thanks

Hi @laba031095 ,

 

Very clear example shows. 

Here's my soltuion.

1.Create a measure

Measure = var _count1=CALCULATE(DISTINCTCOUNT('Table'[Product]),ALLSELECTED('Table'))
var _count2=CALCULATE(COUNT('Table'[Shop]),FILTER(ALLSELECTED('Table'),[Shop]=MAX('Table'[Shop])))
return IF(ISFILTERED('Table'[Product]),IF(_count1=_count2,1),1)

 

2.Put the measure into Filters, and set show items when the value is 1.

vstephenmsft_0-1638343984317.png

 

 

3.Results is as follows.

vstephenmsft_1-1638344009819.png

vstephenmsft_2-1638344026720.png

 

 

Best Regards,

Stephen Tao

 

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

 

speedramps
Super User
Super User

I dont undersrtand  "When choosing SKU and the amount, I can see only those customers who have sold for the required amount and have sold all the selected SKU".  The sentance doeas not make sense.

Stores who sold required amount =
/// this measure assumes you have selected one sku and one amount

// get the selected amount
VAR myamount = SELCETED(Table[amount])

// create a subset for any
VAR mysubset = FILTER(
All(Table[amount]),
All(Table[amount]) >= myamount

RETURN
// how many stores in the subset ?
CALCULATE(
DISTINCT(Table[Store]),
mysubset
)

 

I need to display those who sold all the SKUs that I selected using the filter. I have a SKU filter on my sheet.

negi007
Community Champion
Community Champion

@laba031095 i understand you only need the count of customers who has sold all skus

 

in this case, you can follow the below approach

 

1. first measure to calculate all unique SKUs

SKUs_Total = calculate(DISTINCTCOUNT(sales_table[sku_id]),ALL(sales_table))

 

2. second measure to calculate actual SKUs sold by customer

SKUs_sold = calculate(DISTINCTCOUNT(sales_table[sku_id]),'Table'[Volume]>0)

 

3. third SKUs to count all unique customers who sold all SKUs

Store_selling_all_SKUs = CALCULATE(DISTINCTCOUNT(sales_table[cust_id]),filter(sales_table,sales_table[SKUs_sold]>=sales_table[SKUs_Total]))

 

we could have also created one single measure but for simplicity and explantation 3 different measures were created. You can combine them to create one single measure as well.

 

i hope it helps to solve your problem. thanks




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

No, I need to display those who sold all the SKUs that I selected using the filter. I have a SKU filter on my sheet.

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.