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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PratikVyas
Frequent Visitor

How to One table entry no find in check CLosed by Entry no then value Sum in one variable

How to One table entry no find in check CLosed by Entry no then value Sum in one variable
 

For your reference,

table details 

One table nmae is Cust_LedgEntry Entry no Coloumn check and find entry no . in same table in other coloum CLosedBY ENtry no. then if match entry after value sum in one variable entrywise. it is possible or not?

 

Cust Ledg Entry
Document TypeCustomer posting GroupDocument_NoEntry_No_Collec_AmtinrClosedbyENtrymeas
InvoiceExportud/24-25/0001123500 
Payment pay/24-25/0001487500123
InvoiceDomesticud/24-25/00021251000 
Payment pay/24-25/0002498500125
Payment pay/24-25/0002490300125
      
      
Result     
Document TypeCustomer posting GroupDocument_NoEntry_No_Collec_AmtinrAPPLIED AMT(CR)
InvoiceExportud/24-25/0001123500500
InvoiceDomesticud/24-25/00021251000800
      
      
      
Group Result   
Customer posting GroupCollec_AmtinrAPPLIED AMT(CR)   
Export500500   
Domestic1000800
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PratikVyas ,

Do you mean this is a new table?'APPLIED AMT(CR)' is the result you need, right?

vzhouwenmsft_0-1726037382971.png

Use the following DAX expression to create a measure

APPLIED AMT =
VAR _result =
    ADDCOLUMNS (
        'Cust Ledg Entry',
        "APPLIED AMOUNT",
            SUMX (
                FILTER (
                    'Cust Ledg Entry',
                    [ClosedbyENtrymeas] = EARLIER ( 'Cust Ledg Entry'[Entry_No_] )
                ),
                [Collec_Amtinr]
            )
    )
VAR _group =
    SELECTEDVALUE ( 'Group Result'[Customer posting Group] )
RETURN
    SUMX ( FILTER ( _result, [Customer posting Group] = _group ), [APPLIED AMOUNT] )

vzhouwenmsft_1-1726038932396.png

 

Best Regards,
Wenbin Zhou

View solution in original post

7 REPLIES 7
ahadkarimi
Solution Specialist
Solution Specialist

Hi @PratikVyas, you will need to create a calculated column to find the corresponding matching Entry_No_ based on the ClosedbyENtrymeasgive, trye these and if you encounter any issues, let me know.

MatchedAmount = 
IF (
    NOT(ISBLANK('Cust_LedgEntry'[ClosedbyENtrymeas])),
    CALCULATE (
        SUM('Cust_LedgEntry'[Collec_Amtinr]),
        FILTER (
            'Cust_LedgEntry',
            'Cust_LedgEntry'[Entry_No_] = EARLIER('Cust_LedgEntry'[ClosedbyENtrymeas])
        )
    ),
    BLANK()
)

Next, create a calculated measure:

AppliedAmount = 
SUMX (
    FILTER (
        'Cust_LedgEntry',
        'Cust_LedgEntry'[Entry_No_] = 'Cust_LedgEntry'[ClosedbyENtrymeas]
    ),
    'Cust_LedgEntry'[Collec_Amtinr]
)
GroupResult = 
SUMX (
    'Cust_LedgEntry',
    'Cust_LedgEntry'[Collec_Amtinr] + 'Cust_LedgEntry'[MatchedAmount]
)

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Specialist!

PratikVyas_0-1725933782317.png

 

Error getting

i am selecting Earlier function

Anonymous
Not applicable

Hi ahadkarimi ,thanks for the quick reply, I'll add more.

Hi @PratikVyas ,

Please make sure you create a calculated column and not a measure. 'Earlier' funciton requires row context to calculate. Or you can try this.

Column = 
VAR _Entry_No_ = [Entry_No_]
RETURN SUMX(FILTER('Cust_LedgEntry',[ClosedbyENtrymeas] = _Entry_No_),[Collec_Amtinr])

vzhouwenmsft_0-1725949551980.png

If I understand wrongly, please correct me.

 

Best Regards,
Wenbin Zhou

@Anonymous  it is working fine but i want to result is 

Customer posting group , Collect_AMtinr and Column value this scenario is not working

Group Result   
Customer posting GroupCollec_AmtinrAPPLIED AMT(CR)   
Export500500   
Domestic1000800
Anonymous
Not applicable

Hi @PratikVyas ,

Do you mean this is a new table?'APPLIED AMT(CR)' is the result you need, right?

vzhouwenmsft_0-1726037382971.png

Use the following DAX expression to create a measure

APPLIED AMT =
VAR _result =
    ADDCOLUMNS (
        'Cust Ledg Entry',
        "APPLIED AMOUNT",
            SUMX (
                FILTER (
                    'Cust Ledg Entry',
                    [ClosedbyENtrymeas] = EARLIER ( 'Cust Ledg Entry'[Entry_No_] )
                ),
                [Collec_Amtinr]
            )
    )
VAR _group =
    SELECTEDVALUE ( 'Group Result'[Customer posting Group] )
RETURN
    SUMX ( FILTER ( _result, [Customer posting Group] = _group ), [APPLIED AMOUNT] )

vzhouwenmsft_1-1726038932396.png

 

Best Regards,
Wenbin Zhou

Thanks it is working.

But it is possible no need to new table. Calulation on one table  Cust_LedgEntry

 

Anonymous
Not applicable

Hi PratikVyas,

After creating the calculated column using my method, create a 'Table' visual. Put 'Customer posting Group' in it. Create two measures.

vzhouwenmsft_0-1727070457206.png

Measure = IF(SELECTEDVALUE('Table'[Customer posting Group]) = BLANK(),BLANK(),SUM('Table'[Collec_Amtinr]))
Measure 2 = IF(SELECTEDVALUE('Table'[Customer posting Group]) = BLANK(),BLANK(),SUM('Table'[Column]))

 

Best Regards,
Wenbin Zhou

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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