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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
rphang
Frequent Visitor

Count Unique "Product Type" per Transaction

Hi everyone,

 

I am trying to find out the way to retrive unique counts of "Product Type" per transaction within my sales database.

 

My measure should return the results

-"2" counts for Transaction ID 100001

-"3" counts for Transaction ID 100002

-"1" counts for Transaction ID 100003

-"1" counts for Transaction ID 100004

 

Subsequently with the count calculated above, to display % vs total no. of transaction,

% of Transaction 
1 Type50%
2 Types25%
3 Types25%


My table structure is as such,

- Transaction Details that my POS system input

- Product database that stores Product Assortment

 

Table Name: Transaction Details

Transac IDStore ProductCost
100001Applexx.xx
100001Orangexx.xx
100001Bicyclexx.xx
100002Applexx.xx
100002Bicyclexx.xx
100002Colaxx.xx
100003Orangexx.xx
100003Applexx.xx
100003Pearxx.xx
100003Watermelonxx.xx
100004Orangexx.xx
100004Applexx.xx
100004Pearxx.xx
100004Watermelonxx.xx

 

Table Name: Products

Store ProductProduct Type
AppleFruits
OrangeFruits
BicycleItem
ColaDrinks
PearFruits
WatermelonFruits

 

--

Thank you

Ryan

2 REPLIES 2
Anonymous
Not applicable

 

If you slice by Transaction ID, this will give you the number of different product types per each transaction. If you have several transactions in scope, it'll tell you the same thing but in the context, that is, how many different product types there are in all the visible transactions.

// Products[Store Product] 1 -> * 'Transaction Details'[Store Product]

[Your Measure] =
COUNTROWS(
    SUMMARIZE(
        'Transaction Details',
        'Products'[Product Type]
    )
)

 

This is fantastic, with this measure it solves my first part.

 

Can I check what will be the measure to pull out seperately number of transaction with either count of 1, 2 or 3?

Cause with that I can do X-number of transaction / total transaction to get the % mix.

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.