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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pedroccamaraDBI
Post Partisan
Post Partisan

COUNT from other table

Hello guys
From this model, i would like to be able to count all documentID (Document) that belong to a certain seller name and/or seller type (ContractSeller). Each saller may have more than 1 document and the seller type can have more than one value
apagar0.jpeg
Can you help?
Thanks a lot

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @pedroccamaraDBI ,

 

Per the description, I create some sample data and build the following relationships for them.

ContractSaller Table

vcazhengmsft_0-1646113256194.png

 

Contract Table

vcazhengmsft_1-1646113256196.png

 

Document Table

vcazhengmsft_2-1646113256197.png

 

vcazhengmsft_0-1646127211812.png

 

Then, create the following Measure.

 

CountDocument =

CALCULATE (

    DISTINCTCOUNT ( Document[DocumentID] ),

    TREATAS ( VALUES ( ContractSaller[ContractID] ), Document[ContractID] )

)

 

 

The result should look like this.

vcazhengmsft_4-1646113256198.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @pedroccamaraDBI ,

 

Per the description, I create some sample data and build the following relationships for them.

ContractSaller Table

vcazhengmsft_0-1646113256194.png

 

Contract Table

vcazhengmsft_1-1646113256196.png

 

Document Table

vcazhengmsft_2-1646113256197.png

 

vcazhengmsft_0-1646127211812.png

 

Then, create the following Measure.

 

CountDocument =

CALCULATE (

    DISTINCTCOUNT ( Document[DocumentID] ),

    TREATAS ( VALUES ( ContractSaller[ContractID] ), Document[ContractID] )

)

 

 

The result should look like this.

vcazhengmsft_4-1646113256198.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Thanks a lot @v-cazheng-msft 

PijushRoy
Super User
Super User

Hi @pedroccamaraDBI 

Can you please share sample data or pbix file




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

Proud to be a Super User!





Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.