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
pedroccamaraDBI
Post Partisan
Post Partisan

Count contracts per client on a slicer

Hello all
I would like to have in a slicer the number of contracts made.
Now, i want to know, for example, which clients has 3 contracts or whatever number i choose.
My fact table, contracts, is connected to clients, many to one.
Can you help me on step by step proccess, because last time i thought the solution was good but it turns out not to be good.
This is what i would like to see


Capture.JPG
Thank you all in advance

1 ACCEPTED SOLUTION

Hey @pedroccamaraDBI , it is not a measure but a calculated column that you create on your DIMENSION table (the one with each id/name occuring only 1 time),
And for your example it would give something like :

nbr_contract = CALCULATE(COUNTROWS(FactTable),
FILTER(ALL(FactTable),
DimTable[cliend id] == FactTable[cliend id]))

View solution in original post

6 REPLIES 6
philouduv
Resolver III
Resolver III

Hey @pedroccamaraDBI ,

First create a calculated column on you dimension table containing all clients name (the one part of your relationship)

philouduv_0-1651495603303.png

Then add this column to a slicer if you want to be able to select the number of contract :

philouduv_1-1651495775442.png


Best regards,

 

Hello @philouduv 
Could you please check your measure because i can't do it here. Doesn't allow me to write the filter expression

Hey @pedroccamaraDBI , it is not a measure but a calculated column that you create on your DIMENSION table (the one with each id/name occuring only 1 time),
And for your example it would give something like :

nbr_contract = CALCULATE(COUNTROWS(FactTable),
FILTER(ALL(FactTable),
DimTable[cliend id] == FactTable[cliend id]))

Thanks @philouduv 
Now it's working....Thank you so much

amitchandak
Super User
Super User

@pedroccamaraDBI , seem like you need Avg no of contract per client

 

AverageX(summarize(Contract, Clinet[Client], "_1", Count(Contract[Contract no]) ), [_1])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hello @amitchandak 
I really need the total for each client so i can filter it later on, and may know, for example, which clients has exactly 3 contracts

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.