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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Johan-MTM
Helper III
Helper III

Number of borrower from a library

Hi,

 

JohanMTM_0-1716816170389.png

 

If I want to see how many active borrowers a certain library have I use this:

 

Antal aktiva lånetagare = CALCULATE( COUNTROWS( FILTER( SUMMARIZE( 'Lånetagare' , 'Lånetagare'[Lånetagare ID] , "Lån" , [Antal lån] ) , [Lån] > 1 )))
 
There is an active relationship between Låntagare (borrower) and lån (Loan) and between Lån (loan) and Bibliotek (library).
 
But If i want to see how many borrowers a library have in totalt, not only those who are active I created an inactive relationship and wrote this DAX:
 
Antal låntagare = CALCULATE(COUNTROWS('Lånetagare') , USERELATIONSHIP('Lånetagare'[Bibliotek ID] , Bibliotek[Bibliotek ID]))
 
 I'm not sure this is the correct way to do it, do you guys have any suggestions or input?
 
 
 
4 REPLIES 4
Johan-MTM
Helper III
Helper III

Sorry- double post!

Sergii24
Super User
Super User

Hi @Johan-MTM, what is a benefit of having this inactive relationship between Library and Borrower? A borrower has nothing to do with a library, only with a loan. As well as library is dealing with books, not borrower. So your active relationships should be enough.

To know how many borrowers a certain library has ever had you can simply make a disctinctcount of Låntagare ID from lån table. Therefore, library filters loan, so you know how many unique borrowers have been there (important not to apply any filter on borrower at that moment 🙂 ). To be sure, you can use calculate() and remove any filter on borrower and/or calendar table.

I hope it helps!

Hi @Sergii24 !

Could I ask you to explain abit and maybe give an examle to help me understand?

"(important not to apply any filter on borrower at that moment). To be sure, you can use calculate() and remove any filter on borrower and/or calendar table."

 

 

 

Hi @Sergii24  and thank you for your reply, much appreciated!

I understand your point, but conversely, it is important for us to know how many borrowers are registered at a library. If I go "through" the loan table, I only get the borrowers who have actually made a loan, which is also important, but we also need to know how many borrowers are registered at a library (a borrower can only be registered at ONE library), regardless of whether they have made a loan or not. That's why I have chosen to create an inactive relationship between Library and Borrower.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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