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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mohit_K
Helper I
Helper I

Calculation of Loans

I have two tables

Table 1

Admins Table 
Processingadmin_IDAdmin_Name
1Admin1
2Admin2
3Admin3
  

 

 

Table 2: Loan Table with Created date of last two months: April and May

Loans Table    
LeadIDLead_Created_DateFunding_AmountApprove_DateProcessingadmin_ID
3201/05/21500005/05/211
3302/05/21600006/05/212
3403/04/21003/04/213
3504/04/21700004/05/211
3605/05/21500005/05/212
3706/05/21200008/05/213
3807/05/21  3

 

I want output in following format

Required Output   
Admin_NameApproved Loans Count Leads CountNew Loan Count
Admin1210
Admin2221
Admin3010

 

Logics to be used:

   FromTo
Selected Date (Slicer)Using Lead_Created_Date01/05/2107/05/21

 

Approved Loans Count LogicCount of LeadID from Loans Table if Funding_Amount>0 and Approve_Date is not blank and Approve_Date is between date selected in slicer
Leads Count LogicCount of LeadID from Loans Table if Lead_Created_Date is between date selected in slicer
New Loan CountCount of LeadID from Loans Table if Funding_Amount>0 and Approve_Date is not blank and Approve_Date is between date selected in slicer and Lead_Created_Date=Approve_Date

 

Approved Loan Count should be basis Approved date(Approved date should be between date range selected in slicer) 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

The numbers in Approved Loans Count and Count Leads Count do not follow from the description of the calculations and the initial conditions. You should make the description 1) absolutely clear and 2) show correct numbers because currently there's mistakes/contradictions in the calculations.

View solution in original post

Anonymous
Not applicable

daxer_0-1621277474423.png

daxer_1-1621277540143.png

daxer_2-1621277656253.png

DEFINE 

MEASURE Measures_[Lead Count] = 
// Count of LeadID from Loans Table 
// if Lead_Created_Date is between
// date selected in slicer. This condition
// is automatically satisfied due to the
// relationship between Loans and Created Dates.
DISTINCTCOUNT( Loans[LeadID] )


MEASURE Measures_[New Loan Count] = 
// Your description:
// Count of LeadID from Loans Table 
// if Funding_Amount > 0 and Approve_Date 
// is not blank and Approve_Date is 
// between date selected in slicer
// and Lead_Created_Date = Approve_Date
CALCULATE(
    DISTINCTCOUNT( Loans[LeadID] ),
    KEEPFILTERS( Loans[Funding Amount] > 0 ),
    FILTER(
        SUMMARIZE( 
            Loans,
            Loans[Approval Date],
            Loans[Lead Created]
        ),
        Loans[Approval Date] = Loans[Lead Created]
    )
)


MEASURE Measures_[Approved Loan Count] = 
// Your description:
// Count of LeadID from Loans Table
// if Funding_Amount > 0 and Approve_Date
// is not blank and Approve_Date is between
// date selected in slicer.
CALCULATE(
    COUNTROWS( Loans ),
    KEEPFILTERS(
        TREATAS(
            DISTINCT( 'Created Dates'[Created Date] ),
            Loans[Approval Date]
        )
    ),
    KEEPFILTERS( Loans[Funding Amount] > 0 )
)

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

daxer_0-1621277474423.png

daxer_1-1621277540143.png

daxer_2-1621277656253.png

DEFINE 

MEASURE Measures_[Lead Count] = 
// Count of LeadID from Loans Table 
// if Lead_Created_Date is between
// date selected in slicer. This condition
// is automatically satisfied due to the
// relationship between Loans and Created Dates.
DISTINCTCOUNT( Loans[LeadID] )


MEASURE Measures_[New Loan Count] = 
// Your description:
// Count of LeadID from Loans Table 
// if Funding_Amount > 0 and Approve_Date 
// is not blank and Approve_Date is 
// between date selected in slicer
// and Lead_Created_Date = Approve_Date
CALCULATE(
    DISTINCTCOUNT( Loans[LeadID] ),
    KEEPFILTERS( Loans[Funding Amount] > 0 ),
    FILTER(
        SUMMARIZE( 
            Loans,
            Loans[Approval Date],
            Loans[Lead Created]
        ),
        Loans[Approval Date] = Loans[Lead Created]
    )
)


MEASURE Measures_[Approved Loan Count] = 
// Your description:
// Count of LeadID from Loans Table
// if Funding_Amount > 0 and Approve_Date
// is not blank and Approve_Date is between
// date selected in slicer.
CALCULATE(
    COUNTROWS( Loans ),
    KEEPFILTERS(
        TREATAS(
            DISTINCT( 'Created Dates'[Created Date] ),
            Loans[Approval Date]
        )
    ),
    KEEPFILTERS( Loans[Funding Amount] > 0 )
)

 

Anonymous
Not applicable

The numbers in Approved Loans Count and Count Leads Count do not follow from the description of the calculations and the initial conditions. You should make the description 1) absolutely clear and 2) show correct numbers because currently there's mistakes/contradictions in the calculations.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors