Forum Discussion

wardlea1's avatar
wardlea1
New Member
4 years ago
Solved

Distinct count summarisation issues

Hi all,

 

I am trying to do a count distinct of ID within my data set but i am struggling. Unfortuantely I am unable to share my data but i will try and explain below.

 

I am using a tabular model with relationships built between tables. When looking at ID by division and product i get a result similar to the below. Division and product are located in one table and ID is located in another table. There is a relationship between these tables as otherwise I wouldn't be able to get the data below 'linked'

 

DivisionProductID
A1A001
B3A002
C6A003
B3A004
B3A005
B4A006
C7A007
B5A008
C6A009
A2A010
A1A001
B3A002

 

I then want to do a distinct count of the IDs, bringing back the total as 10 (the last two records in the above are duplicates). This is all fine but when it comes to provide a summary at a higher level the results come out the same for all divisions products. Such as the below

 

DivisionID
A10
B10
C10

 

 

ProductID
110
210
310
410
510
610
710

 

DivisionProductID
A110
A210
B310
B410
B510
C610
C710

 

Whereas what I want is the following

 

DivisionProductID
A11
A21
B33
B41
B51
C61
C72

 

Any suggestions?

 

thanks

 

  • Hi,

    Please check the below picture and the attached pbix file.

    I am not sure if I understood your question correctly, but one of ways is to create a measure like below.

     

2 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

    I am not sure if I understood your question correctly, but one of ways is to create a measure like below.

     

  • MahyarTF's avatar
    MahyarTF
    Memorable Member

    Hi,

    As your sample data I create two tables in Power BI and made a relationship between them:

    - Then create a measure on Sheet with Id :

    CntDivision = DISTINCTCOUNT(Sheet114[Id])
    - Then use the particular measure in my visual as below :

    Appreciate to Kodus