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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to get distinct count in a pivot-like way

Hi all,

 

I'm searching for an answer as I cannot find exact case.. 

 

I have a several tables. One on them contains data about users and other - data about products they buy (X is the biggest product and others are like 55 different ones). 

 

TABLE 1                 different table:          TABLE 2

Products                                                 Users

Product X                                                Company 1

Other product 1                                      Company 2

Other product 2                                      Company 3

Other product 3                                      Company 4

Other product 4                                      Company 5

 

I need to create a table where I show how many distinct users are using 

1) Product X 

2) Any other than product X
3) Product X and 1 other product 

4) Product X and 2 other products

5) Product X and 3 other products

6) Product X and 4 or more other products

result:

Month   Product x            Not using Product X     Product x +1     Product x +2    Product x+3    PRoduct x +=>4
JAN          distinct count       ....                                 ....                        ....                       ....                         .... 

FEB           distinct count          ....                             ...                            ....                     ....                         ....

MAR        ....                                ...                              ....                         ....                     ....                        ....


How can I create this? I know how to do it in excel, but in power bi I cannot create the logic so it looks like a table I could split by months after. 

Please help as this is making my mind blow up! 

3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from here.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi, 

 

It actually did not help. 

 

I was trying to describe my issue in a very simple way but actually there is some level of granularity that I did not picture here and that makes it more complicated. 

IT looks more like this:

TABLE 1                 different table:          TABLE 2

Products                                                 Company                Resellers      Users

Product X                                                Company 1            Reseller A     Random 

Other product 1                                      Company 2            Reseller B     Common

Other product 2                                      Company 3            Reseller C     Else

Other product 3                                      Company 2            Reseller D     Different

Other product 4                                      Company 1            Reseller E      Unknown 

 

So create an overview to see which user under each reseller under what Company - this is what im still struggling with. But thanks for the help effort!

v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

I create a sample you can reference to modify yours.

 

  1. These are my two tables.

1.png

 

  1. Create a measure and add it into a matrix.
Measure = CALCULATE(DISTINCTCOUNT(Table2[Users]),ALLEXCEPT(Table2,Table2[Date].[Month],Table2[Products]))

2.png3.jpg4.png

Best Regards,

Xue Ding

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

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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